Display select box options through script

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

Display select box options through script

Post by Theju112 »

Dear Scott and Team,

I have a text box and a select box in my rich DSPF. My requirement is simple. Whenever, the user clicks on the text box, a user click on the select box should be simulated and the dropdown with the list of options must be displayed. i.e, the select box options dropdown must be displayed as if the user clicked on it.

Please let me know if this can be achieved through a onClick event of the text box widget?

Code: Select all


<select onMouseOut="this.size=1;" onMouseOver="this.size=this.length;">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
      </select>

I have tried the above (replacing the MouseOut/MouseOver events with onClick) but this seems to grey out the select box.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Display select box options through script

Post by Scott Klement »

This sounds a lot like our Combo Box widget. Can you use that?

If you wanted to write your own... we don't actually use a select box for the combo box, even though it looks like one.. instead, we place an image that looks like a down arrow at the edge of the text box, and when you click it, it opens a div element that's styled to look like the list of options.

The code you provided would work as well... but, this does not quite do what you asked...? (It doesn't really open the dropdown, it just displays more options from the dropdown on the screen. If you look in the "All Widgets" section of the widget toolbox, you might notice we have both a dropdown and a list box -- these are actually the same widget with different settings. one shows multiple lines on the display, the other shows one but allows you to drop it down... that's what your HTML/JS code does, too.)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest