struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <jbarr...@sssc.com>
Subject RE: Validate a field only if a checkbox is checked
Date Tue, 04 Jan 2005 20:29:00 GMT


> -----Original Message-----
> From: jecrotea@ca.ibm.com [mailto:jecrotea@ca.ibm.com]
> Sent: Tuesday, January 04, 2005 1:21 PM
> To: Struts Users Mailing List
> Subject: RE: Validate a field only if a checkbox is checked
> 
> 
> yes. It's the combination of the 2.... It will validate the 
> date format
> even if the checkbox is not checked. I would like to validate the date
> format ONLY IF the checkbox is checked.

Ummmmm.. I don't think you can do it like that, unless validwhen will evaluate a regex.  In
which case you might do it.
What is valid data for when the checkbox is not checked?  If that field should not have anything
in it, then letting the data validation do it's thing is fine.


> 
> Thank you for your time.
> 
> --------------------------------------------------------------
> ---------------
> 
> Jean-Francois Croteau
> Services Informatiques
> IBM Canada Ltée (Bromont)
> E-mail : jecrotea@ca.ibm.com
> Tél. : (450) 534-6556
> 
> 
> 
> 
>                                                               
>              
>              "Jim Barrows"                                    
>              
>              <jbarrows@sssc.co                                
>              
>              m>                                               
>           To 
>                                        "Struts Users Mailing 
> List"         
>              2005-01-04 15:14          
> <user@struts.apache.org>            
>                                                               
>           cc 
>                                                               
>              
>              Please respond to                                
>      Subject 
>                "Struts Users           RE: Validate a field 
> only if a      
>                Mailing List"           checkbox is checked    
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
> 
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: jecrotea@ca.ibm.com [mailto:jecrotea@ca.ibm.com]
> > Sent: Tuesday, January 04, 2005 12:53 PM
> > To: Struts Users Mailing List
> > Subject: RE: Validate a field only if a checkbox is checked
> >
> >
> > I tried something like that, but it doesn't work. Other
> > ideas? I search all
> > the mailing list. I've seen a guy with almost the same 
> problem as me,
> > except he was working with radio button. He never had an
> > answer though....
> 
> Can you get just the validwhen working the way you want?
> 
> >
> > Thank you.
> >
> > --------------------------------------------------------------
> > ---------------
> >
> > Jean-Francois Croteau
> > Services Informatiques
> > IBM Canada Ltée (Bromont)
> > E-mail : jecrotea@ca.ibm.com
> > Tél. : (450) 534-6556
> >
> >
> >
> >
> >
> >
> >              "Jim Barrows"
> >
> >              <jbarrows@sssc.co
> >
> >              m>
> >           To
> >                                        "Struts Users Mailing
> > List"
> >              2005-01-04 14:37
> > <user@struts.apache.org>
> >
> >           cc
> >
> >
> >              Please respond to
> >      Subject
> >                "Struts Users           RE: Validate a field
> > only if a
> >                Mailing List"           checkbox is checked
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: jecrotea@ca.ibm.com [mailto:jecrotea@ca.ibm.com]
> > > Sent: Tuesday, January 04, 2005 12:03 PM
> > > To: user@struts.apache.org
> > > Subject: Validate a field only if a checkbox is checked
> > >
> > >
> > >
> > > Hi,
> > >       I want to know, how can I validate a field that must
> > > contains a date
> > > with the DatePattern ONLY IF a checkbox in my form is
> > > checked? For now, I
> > > have this, but it doesn't work at all:
> > >
> > >   <field property="startDate" depends="validWhen, date">
> > >        <arg0 key="searchLots.error.invalidStartDate" />
> > >            <var>
> > >                <var-name>test</var-name>
> > >                <var-value>(customerIdFlg == null)</var-value>
> > >            </var>
> >
> > I haven't played with the validWhen syntax much, but what you
> > are looking
> > to say, I think is something like:
> >              (this not empty && customerIdFlg==true)
> >
> > The date validation you have will make sure that any date
> > entered is valid.
> >
> > >            <var>
> > >                <var-name>datePattern</var-name>
> > >                <var-value>yyyy-MM-dd</var-value>
> > >            </var>
> > >
> > > Anyone have a idea? Thank you.
> > >
> > > --------------------------------------------------------------
> > > ---------------
> > >
> > > Jean-Francois Croteau
> > > Services Informatiques
> > > IBM Canada Ltée (Bromont)
> > >
> > >
> > >
> > >
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message