Hi, TGIF from me too :)

I guess you could try using an iterate tag because it seems that the values
you want are just a sequence, which you can expose using the indexId
attribute.

Otherwise you will need to specify both the property and labelProperty
attributes of the options tag, which lets you have labels that are different
to the values, like this:

<strutshtml:select property="workScheduleDetailDO.dayOfWeek">
       <strutshtml:options name="weekView" property="dayId"
labelProperty="dayName"/>
</strutshtml:select>

But then your collection would have to store an object that has both a
getDayId() and getDayName() method.



-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 20, 2001 10:09 AM
To: [EMAIL PROTECTED]
Subject: html:options value and label


TGIF to all,

I have the following code that generates a <select>:

<strutshtml:select property="workScheduleDetailDO.dayOfWeek">
       <strutshtml:options name="weekView" property="dayNames"/>
</strutshtml:select>

HTML output:

<select name="workScheduleDetailDO.dayOfWeek">
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
</select>


The "dayNames" is a String array in a bean.

I would like my select's values to contain 1-7, rather than actual day
names. 
Is this possible without creating any new getters on my bean?

Desired HTML:

<select name="workScheduleDetailDO.dayOfWeek">
<option value="0">Sunday</option>
<option value="1">Monday</option>
<option value="2">Tuesday</option>
<option value="3">Wednesday</option>
<option value="4">Thursday</option>
<option value="5">Friday</option>
<option value="6">Saturday</option>
</select>


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to