Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

html:select problem

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

I'd like to know how to highlight the first element of a select when I use a htnl ptions collection such as:

<html:select property="deviceList" size="6">
<html ptions collection="devices" property="name" labelProperty="name"/>
</html:select>

If i don't select any option, I have null in the Form.

Thanks in advance,

David
 
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,
The easiest way is to set the form value to the first value. If you don't want to do that, you can use javascript to select it once the page is rendered.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Davide Alagna:
Hi everybody,

I'd like to know how to highlight the first element of a select when I use a htnl ptions collection such as:

<html:select property="deviceList" size="6">
<html ptions collection="devices" property="name" labelProperty="name"/>
</html:select>

If i don't select any option, I have null in the Form.

Thanks in advance,

David



It doesn't have to be highlighted to be submitted with the form. If you have a problem with the ActionForm holding null on submission, there is something else going wrong.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic