combobox problem

Results 1 to 2 of 2

Thread: combobox problem

  1. #1
    Join Date
    Dec 1969

    Default combobox problem

    hi,<BR>How to retrieve the actual value displayed in the combobox on the screen?(option value being different)<BR>e.g., &#060;select&#062;&#060;option value ="1"&#062;Yes&#060;/option&#062;&#060;select&#062;<BR> I want to retrieve "Yes" without using value. <BR>

  2. #2
    Join Date
    Dec 1969

    Default No combobox in HTML

    A combobox is an ActiveX control that allows the user to *either* select an item from a drop down list *or* type in a new value. HTML does not support this concept.<BR><BR>You have a simple "SELECT LIST" or (if you prefer) a "DROP DOWN LIST".<BR><BR>Now, having said that...<BR><BR>&#060;SELECT Name="whatever" onChange="alert(&#039;You chose &#039;+this.options[this.selectedIndex].text);"&#062;<BR>&#060;OPTION Value=1&#062; Yes<BR>&#060;OPTION Value=2&#062; Maybe<BR>&#060;/SELECT&#062;<BR><BR>In other words, instead of using the ".value" property, you use the ".text" property.<BR><BR>Note that you *CAN NOT* get that value in the next page! You can only get it via client-side script on the page where the &#060;SELECT&#062; actually appears.<BR><BR>If you want to get it on the next page (the one the form posts to), then you have to <BR>(1) copy it to a hidden form field before the submit takes place<BR>or<BR>(2) Maybe put both the value *and* the text into the value:<BR>&#060;OPTION Value="1$$Yes"&#062; Yes<BR>and then use SPLIT in your ASP page to get both.<BR>or <BR>(3) Remember (e.g., via a session variable?) how the value and the text relate to each other.<BR><BR>

Posting Permissions

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