By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,447 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,447 IT Pros & Developers. It's quick & easy.

IE8 - FF3.5 Jquery form submit problem.

P: 38
Hello Bytes,

I'm definitely a java newbie and have been working on an application recently and ran into strange behavior between browsers and wondered if anyone could help.

I'm sure my code is going to make you pros cry, but I'm trying!

I have an index php page located at
http://srv.highlydriven.com/dev/acd/

(Text version)

If you click Register in the upper right corner, the register div appears with the form.
Fill in the form and click Register.
This is where the difference occours.

Unbelievably this works as intended in IE8 but not in FF, the registration form is submitted via post to signup.php (txt version).

If the username already exists, it reports that accordingly.
If it does not exist then insert into the db.

In IE8 this is how it happens, but in FF it does this;

Fill in form and submit.
The form reports that the username already exists but it actually inserts the data correctly.

When tailing the mysql log, the signup.php appears to run the query twice but I just don't understand why.

I'm not used to something working in IE but not FF!

If I can provide any other info please let me know and thank you in advance if you are willing to assist this noob.

Regards,
Aaron
Sep 9 '09 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
What FF is doing is correct, though not what you want it to do. The form is being submitted twice because a button click is also a submit (the default). IE went against standards and decided it's a normal button.

See http://www.w3schools.com/tags/tag_button.asp
Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".
Sep 9 '09 #2

P: 38
Ooooooh I see.
So by giving it a type 'button' that fixed it right up.
Man I would have never figured that out.

Figures IE doesn't conform to the standard, reminds me of their own version of IMAP.

Thank you very much acoder.

Now on to my next brain-buster. =P

Respectfully,
Aaron
Sep 9 '09 #3

acoder
Expert Mod 15k+
P: 16,027
Perhaps you should give it a type "submit" and remove the onsubmit code (which just calls submit() anyway).

It's good habit not to rely on defaults anyway. Not all browsers have the same defaults, so it's better to specify exactly what you're after.
Sep 10 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.