Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript &+ doc.form.action, but... 1

Status
Not open for further replies.

disord3r

Programmer
Apr 12, 2002
189
US
I am creating a fairly basic HTML form that is going to be posting data to a form-handling script elsewhere. After numerous incarnations, I've ended up with one form that submits to any number of scripts on the other end (depending on the values/states of certain items in the form) by changing the form's action property through javascript.

As it happens, one of the items the remote site REQUIRES to be sent along with the form data is named "action". So now there's a conflict. When I try set the form action property (doc.formname.action=url), it assumes I'm trying to set the action form item and tells me 'object expected'. Changing that bit of code to doc.formname.action.value=url resolves the error, but is setting the wrong 'action'.

Is there a more specific way of referring to the form's action property? If the remote site had all the scripts combined under one URL, this wouldn't be an issue, but I unfortunately have no control of their script separation, variable names, etc.

Thank you.
 
[red]Change the Field Name!!![/red]

*cLFlaVA
----------------------------
Breaking the habit...
 
That was my first choice I would LOVE to do exactly that, but I'm not in control of that. Already went around and around with them. :)

You and I both realize that I could send the action over under any variable name I wanted, and they could edit their script to reassign the value of my variable to the action variable within their script, but no go on that either. I think problem is that they don't have anyone capable of editing the script. They're using someone elses product and either aren't comfortable or don't have the technical capability to edit it themselves. I offered to do it for them, but they claim security concerns and don't want to let me at their scripts.

Suffice it to say, changing the field name isn't an option for me.
 
You're lucky I like a challenge :)

Try this:

Code:
document.forms['the_form'].attributes['action'].value = 'another.html';"

Tell them this will likely only work in IE6+!!!

*cLFlaVA
----------------------------
Breaking the habit...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top