access struts form in javascript

if you have <html:form action="/someAction"> and in your struts-config.xml, you’ve specified a name for that action (which points to an ActionForm) and your html declaration is <html:html xhtml="true"> and inside your form you have <html:input> (with name of “userName”), then you can do this in your javascript: ( the rendered form will have an attribute name=”formName” )

document.formName.userName.value;

else

document.forms["formName"].userName.value;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s