Forum Moderators: open

Message Too Old, No Replies

Dynamically Assign Form "Action"Attribute in IE

Working fine in Netscape but not in IE...

         

redherring917

8:05 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



Hi there. I've got this:

<form action="shoppingcart.cfm" class="nospace" name="productselect" onSubmit="return OnSubmitForm();">

this:

<input type="image" src="images/addtowishlist.gif" width="96" height="16" border="0" class="addtowishlist" onClick="document.pressed=this.value" VALUE="wishlist">

and this:

<SCRIPT language="JavaScript">
<!--
function OnSubmitForm()
{
if(document.pressed == 'shoppingcart')
{
document.productselect.action ="shoppingcart.cfm";
}
else
if(document.pressed == 'wishlist')
{
alert('hello!');
document.productselect.action ="wishlist.cfm";
}
return true;
}
//-->
</SCRIPT>

Clicking the "wishlist" image pops up the alert box, and then proceeds on to "shoppingcart.cfm" NOT "wishlist.cfm". IE debugging tells me "object doesn't support this property or method", referring to my attempt to revise the "action" attribute.

The kicker is, I DID THIS EXACT SAME THING ON ANOTHER PROJECT AND IT WORKS FINE! I know there must be something different here, but I sure can't see it.

Help? Please?

Thanks.

redherring917

9:27 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



Resolved. Thanks.

Had a hidden input field with the name "action". Very bad idea.