Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating actionfrom using javascript

 
James Winfrey
Ranch Hand
Posts: 62
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic