• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic form processing

 
Dave Kinkead
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to be able to process form data dynamically based on what selection a user makes but am unsure of whih approach to take.
Basically, I want to have a form with 2 or 3 submit options. On submit, the form data is forwarded to the appropriate servlet depending on which submit button was clicked.
How would I do this - can I add some variable to the <form action="/servlet/???"> tag or is it possible to have the individual button forward the form data to a location based on the button's value?
Thanks in advance
Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave, either approach is viable.
If the server-side form processing is similar for the various situations, I think it'd be best to set a hidden parameter on the form that the servlet (or whatever's doing the form processing) can use to adjust the processing accordingly.
If the processing will be different for each case, you can modify the action attribute of the form to specify completely different servlets.
Which approach you take depends upon what makes the most sense for your app.
In either case, this is purely an HTML/Javascript operation, so we might want to move this dicussion here.
hth,
bear
 
Raghunandhan Ramanujam
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the button's value seems to be a cleaner option
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic