Automatically click a field

X

Xerxes

Hi,
can I have a field automatically clicked by calling something like
click()?
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem
is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value). If this
field is automatically selected, the text field des not show; I have to
select another value then click on the "Other (please Specify)" to have
the text field visible.

Thanx.
 
I

Ivo

Hi,
can I have a field automatically clicked by calling something like
click()?

Yes. Newer browsers implement that method for a variety of elements as the
references can tellyou.
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem
is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value).

The problem is you rely on an onchange while sometimes there is none. Create
a dummy option, with a title text and no value, on top, so that one is
selected when there is none selected.

HTH
Ivo
 
X

Xerxes

Thanks Ivo.
The problem with creating a dummy value is that the values of the
dropdown box are set by querying a database, sorted alphabetically. If I
use something like "Select something...", it might fall somewhere in the
middle of the list of values. Any way I can get around it? Can I assign
an index (of zero) to an option?

<SELECT>
<options are filled in from a database in a php file>
< option index=0 (??)>Make a selection</option>
</select>

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top