Retrieve Drop-down box text from the posted form

Results 1 to 2 of 2

Thread: Retrieve Drop-down box text from the posted form

  1. #1
    Join Date
    Dec 1969

    Default Retrieve Drop-down box text from the posted form

    My drop-down list on the form is an id-Text pair.<BR>i.e.<BR>&#060;select name="dropdown"&#062;<BR>&#060;option value=1&#062;abc&#060;/option&#062;<BR>&#060;option value=2&#062;pqr&#060;/option&#062;<BR>&#060;option value=3&#062;xyz&#060;/option&#062;<BR>&#060;/select&#062;<BR><BR>When the form is posted, I want to do two things.<BR>Store the ID value in database. Which is Response.form("dropdown")<BR>I also send an e-mail which should show drop-down box text (i.e. abc, pqr or xyz) and not the ID.<BR><BR>I can get this from the database - but is there any way to achieve this without a database call?<BR><BR>One way I can think of is: Instead of ID being an option value on the form, I make is combination of ID and Text. <BR><BR>On the posted page, I separate them to retrieve text and value.<BR><BR>Is there a straight forward way of doing this which I don&#039;t know?<BR><BR>Thanks,<BR>Paresh.

  2. #2
    Join Date
    Dec 1969

    Default RE: Retrieve Drop-down box text from the posted fo

    No, there&#039;s no straight-forward way. Only the "values" are submitted to the server, not the displayed strings.<BR><BR>You have a choice. Make the "value" a combination of ID and text (as you mentioned), then split it. Or re-query your database again to get the strings.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts