You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Shah, Shrihas (OFT)" <Sh...@oft.state.ny.us> on 2004/05/10 14:44:12 UTC
Validation question:not required but still needs to be validated if entered
Hi :
I have a date field and it is not a required field. If somebody enters
the value then It has to be valid date though. How should I do it? I
have removed required flag in my validation.xml but it still says
required.
My validation.xml entry looks like
<field property="dob"
depends="date">
<arg0 key="createAccountLevel1Form.dob"/>
<var>
<var-name>datePatternStrict</var-name>
<var-value>MM/dd/yyyy</var-value>
</var>
</field>
I removed required flag but it still stays required.
Thanks
Shrihas.
Shrihas Shah
NYS Office for Technology
shrihas.shah@oft.state.ny.us
Phone (518) 408-2382
Fax (518) 473-3389
(US Postal Service Regular Mail Address)
State Capitol ESP, PO Box 2062
Albany, NY 12220-0062
(Parcel Post/Overnight and Interagency Mail Address)
Empire State Plaza
Swan St., Core 4, 1st Floor
Albany, NY 12223
Re: Validation question:not required but still needs to be validated if entered
Posted by Shrihas Shah <sh...@oft.state.ny.us>.
Thanks Sven, I am now doing it with DateValidator class in validator
package. It works.
Shrihas.
--- In struts@yahoogroups.com, Sven Kiesewetter <sv...@m...> wrote:
> I think, you have to implement your own validator. Let is inherent
from
> the original validator and overwrite the appropiate method. Than
you can
> skip the validation if the field was empty.
>
> Sven
>
> Shah, Shrihas (OFT) wrote:
>
> > Hi :
> >
> >
> >
> > I have a date field and it is not a required field. If somebody
enters
> > the value then It has to be valid date though. How should I do
it? I
> > have removed required flag in my validation.xml but it still
says required.
> >
> >
> >
> > My validation.xml entry looks like
> >
> >
> >
> > <field property="dob"
> >
> > depends="date">
> >
> > <arg0 key="createAccountLevel1Form.dob"/>
> >
> > <var>
> >
> > <var-name>datePatternStrict</var-name>
> >
> > <var-value>MM/dd/yyyy</var-value>
> >
> > </var>
> >
> > </field>
> >
> >
> >
> > I removed required flag but it still stays required.
> >
> >
> >
> >
> >
> > Thanks
> >
> >
> >
> > Shrihas.
> >
> >
> >
> > //Shrihas Shah///
> > //NYS Office for Technology//
> > //shrihas.shah@o...//
> > //Phone (518) 408-2382//
> > //Fax (518) 473-3389//
> > //(US Postal Service Regular Mail Address)//
> > //State Capitol ESP, PO Box 2062//
> > //Albany, NY 12220-0062//
> > //(Parcel Post/Overnight and Interagency Mail Address)//
> > //Empire State Plaza//
> > //Swan St., Core 4, 1st Floor//
> > //Albany, NY 12223///
> >
> >
> >
>
>
> -------------------------------------------------------------------
--
> To unsubscribe, e-mail: user-unsubscribe@s...
> For additional commands, e-mail: user-help@s...
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validation question:not required but still needs to be validated
if entered
Posted by Sven Kiesewetter <sv...@mokkafish.com>.
I think, you have to implement your own validator. Let is inherent from
the original validator and overwrite the appropiate method. Than you can
skip the validation if the field was empty.
Sven
Shah, Shrihas (OFT) wrote:
> Hi :
>
>
>
> I have a date field and it is not a required field. If somebody enters
> the value then It has to be valid date though. How should I do it? I
> have removed required flag in my validation.xml but it still says required.
>
>
>
> My validation.xml entry looks like
>
>
>
> <field property="dob"
>
> depends="date">
>
> <arg0 key="createAccountLevel1Form.dob"/>
>
> <var>
>
> <var-name>datePatternStrict</var-name>
>
> <var-value>MM/dd/yyyy</var-value>
>
> </var>
>
> </field>
>
>
>
> I removed required flag but it still stays required.
>
>
>
>
>
> Thanks
>
>
>
> Shrihas.
>
>
>
> //Shrihas Shah///
> //NYS Office for Technology//
> //shrihas.shah@oft.state.ny.us//
> //Phone (518) 408-2382//
> //Fax (518) 473-3389//
> //(US Postal Service Regular Mail Address)//
> //State Capitol ESP, PO Box 2062//
> //Albany, NY 12220-0062//
> //(Parcel Post/Overnight and Interagency Mail Address)//
> //Empire State Plaza//
> //Swan St., Core 4, 1st Floor//
> //Albany, NY 12223///
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org