You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2007/08/21 04:21:34 UTC

[jira] Closed: (STR-1956) Enhance "required" and other validation actions for form reuse

     [ https://issues.apache.org/struts/browse/STR-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict closed STR-1956.
------------------------------

    Resolution: Won't Fix

See Joe's comments.

> Enhance "required" and other validation actions for form reuse
> --------------------------------------------------------------
>
>                 Key: STR-1956
>                 URL: https://issues.apache.org/struts/browse/STR-1956
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.1.0
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Ralf Hauser
>            Priority: Minor
>
> 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?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.