You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Slattery, Tim - BLS" <Sl...@bls.gov> on 2004/03/09 20:06:57 UTC

RE: people using action form field

> If you use a field called "action" in the form, how can you 
> change the form action with javascript. When I try to set the 
> document.form.action it tries to set the field instead of the 
> action for the form. Is there any other way to change the 
> action for the form?

Give the form an "id" attribute:

<form action="whatever" id="formname">

Now you can use the ID attribute to find the form:

document.getElementById("formname").action="newaction.do";

--
Tim Slattery
Slattery_T@bls.gov


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: people using action form field

Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
document.forms[0].action='somethig.do' works to me...

to change a field with name "action", i guess you must do something like 
document.forms[0].action.value

Slattery, Tim - BLS wrote:

>>If you use a field called "action" in the form, how can you 
>>change the form action with javascript. When I try to set the 
>>document.form.action it tries to set the field instead of the 
>>action for the form. Is there any other way to change the 
>>action for the form?
>>    
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: people using action form field

Posted by Julio Cesar De Salvo <jd...@itechnology.com.ar>.
But I cannot set the id element in the <html:form> tag.

Thanks

-----Mensaje original-----
De: Slattery, Tim - BLS [mailto:Slattery.Tim@bls.gov] 
Enviado el: Martes, 09 de Marzo de 2004 04:07 p.m.
Para: 'Struts Users Mailing List'
Asunto: RE: people using action form field

> If you use a field called "action" in the form, how can you 
> change the form action with javascript. When I try to set the 
> document.form.action it tries to set the field instead of the 
> action for the form. Is there any other way to change the 
> action for the form?

Give the form an "id" attribute:

<form action="whatever" id="formname">

Now you can use the ID attribute to find the form:

document.getElementById("formname").action="newaction.do";

--
Tim Slattery
Slattery_T@bls.gov


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org