Clicking enter does not submit the form

Hello,

I have several forms on one page.

When I hit enter it does not post the data from the form I am current in and post it to the correct page.

I have to hit submit in order for it to work correct.

Does this have to do with my isset logic in my code?  I use the isset to determine what submit box is selected.
Thanks.
LVL 1
Codeit1978Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian BushSolutions ArchitectCommented:
If you have more than one field per form, enter will not submit.
I will post you the code to capture the enter key.

--brian
0
Brian BushSolutions ArchitectCommented:
This is an example of how to trap the enter key and have it submit a form.
You may have to do some troubleshooting for making it work across platforms.

<HTML>
<HEAD>
    <SCRIPT LANGUAGE=JAVASCRIPT>
        function TrapKey(form) {
            if (window.event) {
                if (window.event.keyCode == 13) {
                    form.submit();
                }
            return false;
            }
        }
    </SCRIPT>
</HEAD>
<BODY ONLOAD="FORM1.FIELD1.focus();">
    <FORM ID="FORM1" ONKEYDOWN="TrapKey(this)">
        <INPUT TYPE="TEXT" NAME="FIELD1" VALUE="value1"><BR>
    </FORM>
    <FORM ID="FORM2" ONKEYDOWN="TrapKey(this)">
        <INPUT TYPE="TEXT" NAME="FIELD2" VALUE="value2"><BR>
        <INPUT TYPE="TEXT" NAME="FIELD3" VALUE="value3"><BR>
    </FORM>
    <FORM ID="FORM3" ONKEYDOWN="TrapKey(this)">
        <INPUT TYPE="TEXT" NAME="FIELD4" VALUE="value4"><BR>
        <INPUT TYPE="TEXT" NAME="FIELD5" VALUE="value5"><BR>
        <INPUT TYPE="TEXT" NAME="FIELD6" VALUE="value6"><BR>
    </FORM>
</BODY>
</HTML>

--brian
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Codeit1978Author Commented:
This looks perfect, let me give it a go
0
Codeit1978Author Commented:
Humm that's not working it's almost like it's not passing the form.  Did this work for you?
0
Brian BushSolutions ArchitectCommented:
Yup. It works for me with Internet Explorer version 6 in Windows.
These forms are set to GET so the values should show up in the address bar.

Anyway, hitting enter to submit a form is convenient, but it is good form to
always have a button to submit it manually.
--brian
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.