SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist webchalkboard's Avatar
    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>
    I've experienced problems with IE in the past when more than 1 element has the same ID value, but the ID of the form i'm trying to submit is unique on the page.

    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);
    	}
    }
    Thanks,
    Tom
    Websites for Sale - Sell websites in a purpose built marketplace
    Then do some Shopping

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    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?

  3. #3
    SitePoint Evangelist webchalkboard's Avatar
    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
    Websites for Sale - Sell websites in a purpose built marketplace
    Then do some Shopping


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •