Sebastian-

What happens if you remove the "requireList" dependency and just use "mask?"

-Adam

Sebastian Stein wrote:
Hi,

I have a form, which should also use validation based on a mask. I already
enabled this kind of validation in another form and there it works. So I
guess I just have a type or did something wrong during copy&paste. Here is
the form definition in the struts-config.xml:

      <form-bean name="menuForm"
                 type="org.contineo.forms.MenuForm">
         <form-property name="menuText"
                        type="java.lang.String"/>
      </form-bean>

...

      <action input="/AddMenu.do"
              name="menuForm"
              path="/SaveMenu"
              scope="request"
              type="org.contineo.actions.admin.menu.SaveMenuAction"
              validate="true">
         <forward name="addmenu"
                  path="/pages/addMenu.jsp"
                  redirect="false"/>
      </action>

And here is the validation rule:

      <form name="menuForm">
         <field property="menuText"
                depends="requireList,mask">
            <var>
               <var-name>count</var-name>
               <var-value>1</var-value>
            </var>
            <var>
               <var-name>field0</var-name>
               <var-value>menuGroup</var-value>
            </var>
            <var>
               <var-name>mask</var-name>
               <var-value>^[a-zA-Z]*$</var-value>
            </var>
            <msg name="menuForm.menuText"
                 key="errors.required"
                 resource="true"/>
            <msg name="mask"
                 key="errors.val.username"
                 resource="true"/>
         </field>
      </form>

Interestingly the requireList validation rule works. So if the user does not
select something in field0, the validation fails. However, the mask rule is
not applied. It seems the content of menuText is not checked against the
pattern.

Does anybody can spot the error? I'm using Struts 1.1.


Sebastian

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to