Since I am not an HTML wizard (yet :) ) my first attempt was as follows:

What also bugs me is the scriplet iteration using actual java code - any
idea how to do it more elegant?



<!-- birthdate -->
<tr>
   <td><bean:message key="userInfo.birthDate"/></td>
   <td>
        <!-- birth year -->
        <html:select property="property(profile-birthYear)">
             <html:option value="year"><bean:message
key="date.year"/></html:option>
        <%
           for (int i = 17; i < 90; i++) {
        %>
           <html:option value="<%=Integer.toString(2003-i)%>"
><%=2003-i%></html:option>
        <%
        }
        %>
        </html:select>


                        <!-- birth month -->
                        <html:select
property="property(profile-birthMonth)">
                                <html:option value="month"><bean:message
key="date.month"/></html:option>
                        <%
                                for (int k = 1; k <= 12; k++) {
                        %>
                                <html:option
value="<%=Integer.toString(k)%>" ><%=k%></html:option>
                        <%
                        }
                        %>
                        </html:select>


                        <!-- birth day -->
                        <html:select
property="property(profile-birthDay)">
                                <html:option value="day"><bean:message
key="date.day"/></html:option>
                        <%
                                for (int i = 1; i <= 31; i++) {
                        %>
                                <html:option
value="<%=Integer.toString(i)%>" ><%=i%></html:option>
                        <%
                        }
                        %>
                        </html:select>
                        </td>
                </tr>

Erez

-----Original Message-----
From: Alex Shneyderman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 23, 2003 8:30 PM
To: 'Struts Users Mailing List'
Subject: RE: Birthdate validation ?

There is a date validator. I am not sure why a birthdate is any
different?
How do you present your field to the user is it a one input text?

> -----Original Message-----
> From: Erez Efrati [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 23, 2003 3:25 PM
> To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> Subject: RE: Birthdate validation ?
> 
> Thanks for the quick reply, seems pretty easy but a bit long for just
a
> date. Anyway, is there a validator I could use or do I have to write
one
> of my own? And I mean Struts Validator..
> 
> Erez
> 
> -----Original Message-----
> From: Alex Shneyderman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 23, 2003 8:21 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Birthdate validation ?
> 
> Be carefull with that because if you set Feb 29, 2003 your date is
going
> to be March 1, 2003 and Calendar will not say a thing. You should
> probably fix a birthdate validator.
> 
> > -----Original Message-----
> > From: Adam Levine [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 23, 2003 2:18 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Birthdate validation ?
> >
> >
> > Use Calendar, more than likely the concrete GregorianCalendar.
> >
> >   Calendar.setField(<field>, <field value>);  x3
> >
> >   Calendar.getTime() -> Date
> >
> >
> > From: Erez Efrati <[EMAIL PROTECTED]>
> > Reply-To: "Struts Users Mailing List"
<[EMAIL PROTECTED]>
> > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> > Subject: Birthdate validation ?
> > Date: Wed, 23 Jul 2003 21:03:53 +0200
> >
> > I have a birth date field composed of three different fields of day
> > month and a year. Now, what is the best way to receive those three
and
> > combine them into a java.sql.Date class and performing validation
> using
> > the validator?
> >
> > Hope someone been there done that..
> >
> > Thanks,
> > Erez
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > _________________________________________________________________
> > Add photos to your messages with MSN 8. Get 2 months FREE*.
> > http://join.msn.com/?page=features/featuredemail
> >
> >
> >
---------------------------------------------------------------------
> > 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]



---------------------------------------------------------------------
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