Re: Trap CR or "Enter" possible?

From: Date: Fri, 22 Mar 2002 17:29:14 +0000
Subject: Re: Trap CR or "Enter" possible?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89709@lists.php.net to get a copy of this message
On Saturday 23 March 2002 00:11, Erik Price wrote: > On Friday, March 22, 2002, at 12:11 AM, Jason Wong wrote: > > But, what are the undesirable effects of just pressing enter? I know > > that in > > IE pressing enter to submit a form is not the same as clicking on the > > submit > > button. If that is what you are referring to then it's very easy to code > > around that and thus would not require javascript. > > I have noticed that pressing enter in IE does achieve the same effect as > pressing the "submit" button for my forms. But I have also heard that > it's not really "the same", especially if there are more than one > "submit"-style inputs for the given form. What does Enter "really" do > in IE? I don't know what it does. But what it *doesn't* do is pass on the value of the submit button(s). > Side note to the original poster: in the script that is the target of > the form you are writing, you may be able to test for the presence of > the "submit" variable -- if this value is not present, then the user has > not clicked the Submit button. I know that the "value" of a submit > input is usually just used to label the button in some way (such as > value="Click Here for Free Porn!"), but you can actually test for this > value if you have given the Submit input a name. I may be wrong about > this, though. Thus if you relied upon testing for the value of the submit button to determine whether the form had been submitted (as opposed to being viewed for the first time) then you're going to get unexpected results. One way to code around it would be to add a hidden field in your form and test for the presence of that rather than the submit button. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Newton's Law of Gravitation: What goes up must come down. But don't expect it to come down where you can find it. Murphy's Law applies to Newton's. */

« previous php.general (#89709) next »