This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating actionfrom using javascript

 
James Winfrey
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic