Connecting Tech Pros Worldwide Forums | Help | Site Map

Browser Bug: 'Object does not support property' error when setting form action (IE6)

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#1   Aug 18 '07
Problem
When setting the FORM object's action property an "Object does not support this property or method" error occurs

Browser
Internet Explorer 6-

Example
The Javascript code:
Expand|Select|Wrap|Line Numbers
  1. var theForm = document.getElementById("formID");
  2. theForm.action = "actionpage.php";
  3. theForm.submit();
Some relevant HTML:[HTML]<input name="action" type="submit" ...>[/HTML]
Solution
This is caused by using the name "action" for the submit button which causes IE to be confused between the submit button object and the form's action property. The solution is to rename the submit button (or whatever button or element you have named with a form property).

It's a bad habit to use reserved words for naming objects anyway.

More Bugs, Quirks and Inconsistencies



Reply


Similar JavaScript / Ajax / DHTML bytes