You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by da...@efsnetwork.com on 2003/09/18 19:12:00 UTC

design question regarding multiple submit buttons

I'm building a small web application (which I expect to grow into something more) to allow co-workers to do some data entry. I'm more of a database guy, but would like to understand and learn the possibilities of utilizing web services.   And, have a question about using multiple submit buttons.

I am following the advice from http://husted.com/struts/tips/002.html and have 2 buttons "ADD" and "DONE".  The form allows a user to input an address (there are typically several) to the Action which updates the database, calls the reset method on the form, then redirects the user to the same form so they can input another address.  When they have no more addresses to enter, they should hit "DONE" to move on to the next form.  However, when "DONE" is selected, the form calls the validate method, which of course fails because the fields are empty.

My question is regarding the design.  Is this type of circular design ok, meaning it won't bite me later.  If so, how should I implement it?  Do I code in fake entries to the "DONE" button then ignore it in the action (is this possible)?  Can I turn off validation for the "DONE" button?  Do I add a new form to the jsp and add the "DONE" button to it?  .... or, maybe I didn't set up the dispatch action correctly.  

I expect to use this same type of logic several times in the app, so I want to make sure I go about it the correct way.  If someone could point me in the right direction, I would appreciate it.

Thank you,
David