> -----Original Message-----
> From: struts lover [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 26, 2004 12:49 PM
> To: Struts Users Mailing List
> Subject: Re: date parsing/validation...newbie
> 
> 
> Hi,
> I think it should be
> 
> <var-value>dd/MM/yyyy</var-value>
> instead of
> 
> <var-value>dd/MMM/yyyy</var-value>

He wants the month as Jan, not 01, so no that's  not it.


> 
> --- Research labs <[EMAIL PROTECTED]> wrote:
> 
> > Hi, 
> > 
> > Please help me.  
> > 
> > I am trying to force users to enter dates in the
> > format 23/JAN/2003, therefore, I have the setting
> > below in the validator.xml.  The maxlength bit
> > works,
> > but date parsing does not work, for example the
> > validator does not complain if I enter an invalid
> > date
> > such as 23/JJJ/1996. As you are aware, JJJ is not a
> > valid month.  Can you please tell me what I am doing
> > wrong.
> >     <field property="dob"
> >                     depends="maxlength,date">
> >                     <arg0 key="cargoForm.dob"/>
> >                    <arg1 name="maxlength"
> > key="${var:maxlength}" resource="false"/>
> >                     <var>
> >                       
> > <var-name>datePattern</var-name>
> >                       
> > <var-value>dd/MMM/yyyy</var-value>
> >                     </var>
> >                     <var>
> >                       
> > <var-name>maxlength</var-name>
> >                        <var-value>11</var-value>
> >                     </var>
> >     </field>

THis looks right, although I think the minLength and maxLength are overkill, the date 
should do it.  Have you tried removing those to see if it works?



> >             If you have any example or link to a doc, please
> > send it.    
> > 
> > Thank you.
> > 
> > Ola.
> > 
> > 
> > 
> > 
> > --- Research labs <[EMAIL PROTECTED]> wrote:
> > 
> > > Noted. Thank you very much.
> > > 
> > >  --- Erik Weber <[EMAIL PROTECTED]> wrote: 
> > > > Looks to me like you probably want dd/MM/yyyy.
> > > > 
> > > > Erik
> > > > 
> > > > 
> > > > Erik Weber wrote:
> > > > 
> > > > > Please see the API documentation for
> > > > java.text.SimpleDateFormat's 
> > > > > pattern syntax, which you are violating with
> > > > DD/MON/YYYY. "MON" is not 
> > > > > an acceptable token, and DD is day-in-year,
> > not
> > > > day in month.
> > > > >
> > > > > Erik
> > > > >
> > > > >
> > > > > Research labs wrote:
> > > > >
> > > > >> Can anyone please tell what I can do in order
> > > to
> > > > stop
> > > > >> users from entering invalid dates. The
> > > validator
> > > > does
> > > > >> not raise an error if a user enters 33 as ad
> > > day,
> > > > as
> > > > >> in this sample date: 33/jan/2000.
> > > > >>
> > > > >> I am using Struts validator, which is setup
> > as
> > > > >> follows:
> > > > >> <field property="dob"
> > > > >> depends="maxlength,date">
> > > > >> <arg0 key="cargoForm.dob"/>
> > > > >> <arg1 name="maxlength"
> > > > >> key="${var:maxlength}" resource="false"/>
> > > > >> <var>
> > > > >> <var-name>datePattern</var-name>
> > > > >> <var-value>DD/MON/YYYY</var-value>
> > > > >> </var>
> > > > >> <var>
> > > > >> <var-name>maxlength</var-name>
> > > > >> <var-value>11</var-value>
> > > > >> </var>
> > > > >> </field>
> > > > >>
> > > > >> Thanks.
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > >
> > >
> >
> ___________________________________________________________ALL-NEW
> > > > 
> > > > >> Yahoo! Messenger - all new features - even
> > more
> > > > fun! 
> > > > >> http://uk.messenger.yahoo.com
> > > > >>
> > > > >>
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > >> 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]
> > > > >
> > > > >
> > > > 
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > > 
> > > >  
> > > 
> > > 
> > >   
> > >   
> > >           
> > >
> >
> ___________________________________________________________ALL-NEW
> > > Yahoo! Messenger - all new features - even more
> > fun!
> > >  http://uk.messenger.yahoo.com
> > >  
> > 
> > 
> >     
> >     
> >             
> >
> ___________________________________________________________ALL-NEW
> > Yahoo! Messenger - all new features - even more fun!
> >  http://uk.messenger.yahoo.com
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>               
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> 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