You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/28 17:13:43 UTC

DO NOT REPLY [Bug 17532] New: - Newbie FAQ: How can I avoid validating a form before data is entered?

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17532>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17532

Newbie FAQ: How can I avoid validating a form before data is entered?

           Summary: Newbie FAQ: How can I avoid validating a form before
                    data is entered?
           Product: Struts
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Documentation
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: edgar@blue-moose.net


The simplest way is to have two actions.  The first one has the job of setting 
the form data, i.e. a blank registration screen.  The second action in our 
hypothetical would be to write the registration data to the database.  Struts 
would take care of invoking the validation and returning the user to the 
correct screen if validation was not complete.

Note that the form is the same form across both actions.

<action path="/formloadaction" 
    type="actions.MyFormLoadAction"
    validate="false" 
    name="MyForm">
        <forward name="realaction" path="realaction.tile" />
</action>

<action path="/realformaction" 
    type="actions.MyFormAction"
    validate="true" 
    input="realaction.tile"
    name="MyForm">
        <forward name="morevalidations" path="realaction.tile" />
        <forward name="success" path="success.tile" />
</action>

As you get more advanced, you can reuse the action with either a lookup action 
form or look at the request yourself to determine the action.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org