• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Combobox: How to set display field and value field

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I need some help with javascript. I have a combobox(dropdown) with the following data

<option value='1'> AAA</option>
<option value='2'> BBB</option>
<option value='3'> CCC</option>
<option value='4'> DDD</option>

When I select something, I see the numbers. For eg. if I select CCC, it displays 3.But I want to show CCC. How could I do this.
I need to hide the values from showing to user.

Thanks.
 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't have a ComboBox unless you're using some sort of UI library or have some other JavaScript doing stuff. We're not going to be able to help unless you tell us what that is. A standard HTML select works exactly like you say you want.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Loganathan Karunakaran wrote:I have a combobox(dropdown)


As Rob pointed out, unlikely. We even have a FAQ entry for this: HtmlHasNoComboBox

When I select something, I see the numbers.


Where do you see the numbers? In the submission? Yes, that's correct. Elsewhere? If so, where?
 
reply
    Bookmark Topic Watch Topic
  • New Topic