You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yaragalla Muralidhar <ya...@gmail.com> on 2013/09/19 22:15:59 UTC

validators strange behavior

I have written validators for 3 fields but only validation is happening for
one field. Out of 3 fields the validation is happening only for
"primDet.admissionDate" field. even though the the text fields are empty
for the other 2, the validation is not happening.

The following is the xx-validation.xml file:-

<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "
http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
<validators>
    <field name="primDet.admissionNo">
     <field-validator type="regex">
          <param name="regex"><![CDATA[\d{3,}]]></param>
       <message key="error.admission.no">Could not find error.admission.no
!</message>
     </field-validator>
    </field>

    <field name="primDet.admissionDate">
     <field-validator type="regex">
          <param name="regex"><![CDATA[\d{2}/\d{2}/\d{4}]]></param>
       <message key="error.admission.date">Could not find
error.admission.date</message>
     </field-validator>
    </field>

    <field name="primDet.applicationNo">
     <field-validator type="regex">
          <param name="regex"><![CDATA[\d{3}]]></param>
       <message key="error.admission.date">Could not find
error.admission.date</message>
     </field-validator>
    </field>
</validators>

My jsp is as below:-

<form id="form" method="post" action="primaryDetails.action">
<input type="text" class="text" size="15" name="primDet.admissionNo" />
<input type="text" class="text" style="color:#DDD4E7" value="dd/mm/yyyy"
onclick="displayCalendar(event,this)" size="15"
name="primDet.admissionDate"/>
<input type="text" class="text" size="15" name="primDet.applicationNo"/>
</form>

what is the problem? why this is happening? kindly help?

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*

Re: validators strange behavior

Posted by Yaragalla Muralidhar <ya...@gmail.com>.
This problem is also solved. Thanks.

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


On Fri, Sep 20, 2013 at 1:45 AM, Yaragalla Muralidhar <
yaragallamurali@gmail.com> wrote:

> I have written validators for 3 fields but only validation is happening
> for one field. Out of 3 fields the validation is happening only for
> "primDet.admissionDate" field. even though the the text fields are empty
> for the other 2, the validation is not happening.
>
> The following is the xx-validation.xml file:-
>
> <!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "
> http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
> <validators>
>     <field name="primDet.admissionNo">
>      <field-validator type="regex">
>           <param name="regex"><![CDATA[\d{3,}]]></param>
>        <message key="error.admission.no">Could not find error.admission.no
> !</message>
>      </field-validator>
>     </field>
>
>     <field name="primDet.admissionDate">
>      <field-validator type="regex">
>           <param name="regex"><![CDATA[\d{2}/\d{2}/\d{4}]]></param>
>        <message key="error.admission.date">Could not find
> error.admission.date</message>
>      </field-validator>
>     </field>
>
>     <field name="primDet.applicationNo">
>      <field-validator type="regex">
>           <param name="regex"><![CDATA[\d{3}]]></param>
>        <message key="error.admission.date">Could not find
> error.admission.date</message>
>      </field-validator>
>     </field>
> </validators>
>
> My jsp is as below:-
>
> <form id="form" method="post" action="primaryDetails.action">
> <input type="text" class="text" size="15" name="primDet.admissionNo" />
> <input type="text" class="text" style="color:#DDD4E7" value="dd/mm/yyyy"
> onclick="displayCalendar(event,this)" size="15"
> name="primDet.admissionDate"/>
> <input type="text" class="text" size="15" name="primDet.applicationNo"/>
> </form>
>
> what is the problem? why this is happening? kindly help?
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
> *
> *
>