Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting a preselected value in a combo  RSS feed

 
Rebecca Abraham
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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
 
aitor alzola
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
vishwa venkat
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • 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>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!