aspose file tools*
The moose likes Struts and the fly likes Updating actionfrom using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Updating actionfrom using javascript" Watch "Updating actionfrom using javascript" New topic
Author

Updating actionfrom using javascript

James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 60
Hi Guys

Can I set the values of actionform in javascript?


JSP Code:



JavaScript Code:



The formBean and actions are correctly configured in struts-config.xml.

The above code does not update the actionform.

Thanks
James

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you verified you're accessing the DOM element you believe you are?

Also, you're not updating "the ActionForm", you're updating the DOM element. The ActionForm wouldn't be updated until a submission.
James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 60
Thanks David for your reply.

The DOM element gets updated and the form is submitted using javascript.

But the Changes are not reflected in the ActionForm.

We are using input button of type submit.

James
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you are correctly updating the form value via JavaScript, and that form value is being submitted as an empty string, and the form bean doesn't do anything other than take the form value, then it will work. So one of those steps is likely not doing what you think it is.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updating actionfrom using javascript
 
Similar Threads
Problem using Validation: validwhen condition not working
Logic iterate and vo
validate two passwords in struts
how to set value of text field
jQuery advantages over javascript