SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Form submit bug IE 6
-
Jul 5, 2007, 03:14 #1
- Join Date
- Jan 2005
- Location
- Bristol, UK
- Posts
- 494
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Form submit bug IE 6
Yes i'm afraid we still have users using IE 6 and no matter how much I scream and shout about it, we need to support them!
I've got a link which users javascript to submit a form, but for some reason this isn't working at the moment and I can't see to get to the root of the problem.
Code:<a href="javascript:void(0);" onClick="setValue('contact_id', '12'); submitForm('contact_request', 'accept_contact_request');" title="Accept and add to contacts">Submit Form</a>
This is the code i'm using to submit the form.
Code:function submitForm(form_id, form_action) { var form = getElement(form_id); try { if(form_action != "") { form.elements.action.value = form_action; } form.submit(); } catch(error) { alert("There was an error.\n\nThe likely cause is that you are using Internet Explorer which generally doesn't follow the rules.\n\nYou should really be using Firefox.\n\nTo get Firefox please goto http://www.getfirefox.com.\n\nThe error generated was: "+error.description); } }
Tom
-
Jul 5, 2007, 04:58 #2
- Join Date
- May 2003
- Location
- Cambridge, UK
- Posts
- 2,366
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Why are you using JavaScript to submit the form? Wouldn't it be simpler to just put the action in the <form> tag and submit it using a regular submit button?
-
Jul 10, 2007, 13:30 #3
- Join Date
- Jan 2005
- Location
- Bristol, UK
- Posts
- 494
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
It turns out that the javascript:void bit in the anchor tag was stopping it working. I took that out and it works fine. It's a bit complicated why we are using javascript to submit the form, except there are multiple actions on the page and javascript allows us to have one form but set the action value differently depending which link is clicked. (If that makes sense)
Thanks for your help.
Tom
Bookmarks