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 2004/01/28 09:04:19 UTC

DO NOT REPLY [Bug 26486] New: - enhance "required" and other validation actions for form reuse

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=26486>.
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=26486

enhance "required" and other validation actions for form reuse

           Summary: enhance "required" and other validation actions for form
                    reuse
           Product: Struts
           Version: 1.1 Final
          Platform: Other
               URL: http://jakarta.apache.org/commons/dtds/validator_1_1.dtd
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: hauser@acm.org


The registration form is the example used often.

What should a programmer do if a registered user later can change her/his profile?

My assumption would be to re-use the same form since the fields are almost
identical?

Except that in this case, a user should no longer be able to change the login
name or for example a once chosen price plan that last several month as per the T&C.

When using validator actions in this scenario, I expect several problems to occur:
Depending on the the form's "action" context (e.g. registerAction.do or
changeProfileAction.do)
1) a field required in one context is not required in another (or even "not
allowed" in the other)
2) if both form action contexts are using a wizard, the page number for a
particular field may not be the same?

Conclusion --> Suggestion:
==========================
- the "required" value of the "depends" attribute might better be an attribute 
to a "rule" element that has an "action" attribute and "page" attribute?

e.g. your example 
         <field    property="lastName"
         	   depends="required,mask"
                   page="1">
         	     <msg name="mask" key="registrationForm.lastname.maskmsg"/>
         	     <arg0 key="registrationForm.lastname.displayname"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^[a-zA-Z]*$</var-value>
                     </var>
         </field>
...
         <field    property="email"
         	   depends="required,email"
                   page="2">
         	     <arg0 key="registrationForm.email.displayname"/>
         </field>

could then be
         <field    property="lastName">
           <rule "required" action="registerAction" page="1" />
           <rule "required" action="changeProfileAction" page="2" />
           <rule "mask" action="registerAction" page="1" />
           <rule "mask" action="changeProfileAction" page="3" />
         	 <msg name="mask" key="registrationForm.lastname.maskmsg"/>
         	 <arg position="0" key="registrationForm.lastname.displayname"/>
                 <var>
                     <var-name>mask</var-name>
                     <var-value>^[a-zA-Z]*$</var-value>
                 </var>
         </field>
...
         <field property="emailLogin" page="2">
           <rule "required" action="registerAction" />
           <rule "email" action="registerAction" />
             <!-- no need to have an "unchanged" rule since
                  changeProfileAction.java would not act upon an emailLogin
                  form field submitted by a browser anyway -->
         	 <arg position="0" key="registrationForm.email.displayname"/>
         </field>

What do you think?

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