Forum Moderators: phranque

Message Too Old, No Replies

Submit button not being sent when enter hit on form

         

Demaestro

9:09 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This thing has happened before and I am not able to find how or why, but it has just happened again and I really want some input on how this happens.

Ok I have a form it has 3 hidden form elements one text box and one submit button. The submit button is a regular input type="submit"> tag. When I click the submit button it takes the action and sends the value of the submit button along with all the other form elements. No problem

Now when the form has focus and you hit enter on the keyboard it sends the all the form elements EXCEPT it does not send the submit button along with the posted information that was contained withen the form.

Now because the subsiquent form checks to see what the value of the submit button that accompanied the form to decide on what action to take, it is totally messing up.

What I had to do was add another hidden form element and gave it a name and a value that I could check against rather than checking the value of the submit button, and it works now! Clicking or hitting enter!

What causes the submit button, which is a form element, to not get passed with the rest of the form when the enter button is hit rather than clicking the submit button directly?

DaveAtIFG

9:44 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have no idea but I think I'd first see if it acted the same in a variety of browsers. It may be that your version/browser simply has a bug...

Demaestro

9:01 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It was doing it in Mozilla as well as IE. It is wierd because I cant duplicate it expect on the page that was doing it originally. That makes me think that I was missing a close tag or something. I have ran it through a html parser and it didnt return any problems with my tags.

WIERD

DaveAtIFG

1:04 pm on Feb 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hitting enter probably adds a "line ender" character to the string passed to the forms script. I'm thinking the script may not be expecting it and is handling it incorrectly.