• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Setting a preselected value in a combo

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

When using Struts, is it possible to set a selected value for a combo box? For example I have the following combo:

<html:select property="tskWeekEndDate">
<html ption value=""></html ption>
<html ption value="Nov6">06-Nov-2004</html ption>
<html ption value="Nov12">12-Nov-2004</html ption>
</html:select>

How do I set 'Nov6' as a pre-selected value?

Thanks.

Rebecca
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The selected value is the first
try this :
<html:select property="tskWeekEndDate">
<html ption value=""></html ption>
<html ption value="Nov6">06-Nov-2004</html ption>
<html ption value="Nov12">12-Nov-2004</html ption>
</html:select>
Good Luck!
 
Rebecca Abraham
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please be more specific? I mean, I was unable to understand what exactly I need to do. What I require is that the date fetched from the database should be selected in the combo.

For example if "Nov26" is returned from the database, I want this value to be displayed as selected in the combo.

Thanks.
Rebecca
 
aitor alzola
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry :banghead , I did the last post wrong:
try this :

<html:select property="tskWeekEndDate">
<html: option value="Nov6">06-Nov-2004</html: option>
<html: option value="Nov12">12-Nov-2004</html: option>
</html:select>

The fist value in the combo is the one pre-selected, in this case is Nov6

Good luck! :banghead
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this..U have to sepcify the selected value in the "value" attribute of "select"..



<html:select property="tskWeekEndDate" value="Nov6">
<html: option value="Nov12">12-Nov-2004</html: option>
<html: option value="Nov6">06-Nov-2004</html: option>
</html:select>
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic