how to set the value of <select> dynamically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msg2ajay
    New Member
    • Jun 2007
    • 17

    how to set the value of <select> dynamically

    hi all,
    I have a problem with <html:select> i am getting a value from the database
    but it is not setting to my <select value>. Can any bady tellme what is the problem. My code is given below..


    Code:
    <html:select property="conttitle" styleClass="dropdown" value="${conttitle}">
            <html:option value="1">1 - Mr</html:option>
            <html:option value="2">2 - Ms</html:option>
        </html:select>
    thx in Adv,
    HAN.
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    I don't have a clue what any of that is. It's not HTML.

    Comment

    • gregerly
      Recognized Expert New Member
      • Sep 2006
      • 192

      #3
      Originally posted by drhowarddrfine
      I don't have a clue what any of that is. It's not HTML.
      Wow, what is that? a select tag looks like this:

      [HTML]<select name='myselect' >
      <option value='someVal' selected='selec ted'>This option is selected</option>
      <option value='someOthe rVal'>Some Other Val</option>
      </select>[/HTML]

      If you want the option to be selected by default, you just have to add "selected='sele cted'" attribute.

      Hope that helps.

      greg

      Comment

      Working...