You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ramu, Manjukumar [PRDUS]" <MR...@prdus.jnj.com> on 2002/07/23 21:34:30 UTC

Refering form variables from the JavaScript function

Hello,
   I have a form <html:form action="/nominationAction" > in a JSP, I am
calling Javascript function for an event. I want to set some values of the
parameters within the form in using Javascript.

For Ex : 
function f1 ("value")
{
	form.name = "value"
}

Can any body tell me how to refer form variables from the JavaScript
function in Struts based JSP?

I appreciate your help!

Thanks,
Manju

Re: Refering form variables from the JavaScript function

Posted by ajTreece <aj...@sun.com>.
I do this quite a bit using JavaScript to test for (validate) user input in a 
form.  A property variable in the ActionForm acts just like a normal HTML 
element. You ca set a form variable like this:

document.{your form name}.{ActionForm property}.value = "Yadda Yadda Yadda";

Hope this helps...



Ramu, Manjukumar [PRDUS] wrote:

> Hello,
>    I have a form <html:form action="/nominationAction" > in a JSP, I am
> calling Javascript function for an event. I want to set some values of the
> parameters within the form in using Javascript.
> 
> For Ex : 
> function f1 ("value")
> {
> 	form.name = "value"
> }
> 
> Can any body tell me how to refer form variables from the JavaScript
> function in Struts based JSP?
> 
> I appreciate your help!
> 
> Thanks,
> Manju
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Refering form variables from the JavaScript function

Posted by James Mitchell <jm...@telocity.com>.
Have you seen the way its done in the struts-example.war?

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta




> -----Original Message-----
> From: Ramu, Manjukumar [PRDUS] [mailto:MRamu@prdus.jnj.com]
> Sent: Tuesday, July 23, 2002 3:35 PM
> To: Struts Users Mailing List
> Subject: Refering form variables from the JavaScript function
>
>
> Hello,
>    I have a form <html:form action="/nominationAction" > in a JSP, I am
> calling Javascript function for an event. I want to set some values of the
> parameters within the form in using Javascript.
>
> For Ex :
> function f1 ("value")
> {
> 	form.name = "value"
> }
>
> Can any body tell me how to refer form variables from the JavaScript
> function in Struts based JSP?
>
> I appreciate your help!
>
> Thanks,
> Manju
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>