Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown List's OnChange Event

Status
Not open for further replies.

cid

Programmer
Jan 4, 2001
18
US
For some reason, the OnChange event is not being fired when I change the value of a drop-down list. I need to unhide a text box depending on the value of the drop-down. If someone could help me with this, I'd appreciate it. Thanks! ~[ cid ]~

web // email // cid@cjd-web.com
aim // ciddivine
 
put debug.print messages in the _click, _change, and other events of interest to examine the behavior. The _change event won't fire for dropdown list style, only for combo style. The "change" is the change of the text in the combo box.

The event you're looking for is _click.
-Bob
 
If I put it in the _click event, that won't effect when a user tabs to it. Do I need to just write a function that I'll call for a focus change and the click event and so on? Seems rediculous. Let me know if there's something better.

Thanks, tho! ~[ cid ]~

web // email // cid@cjd-web.com
aim // ciddivine
 
The main point is that Change is not the entry point to the list change, but click is. It sounds like you're doing this in jscript perhaps?

Anyway, if it's VB, you could always use a form-level variable to compare the listindex (or a static local variable) to know when to go further (into un/hiding the text box.

(As an aside, you will find things become unmanageable quickly if you're putting the form's state management all over the form code. This can give you a severe case of the cascading side effect syndrome. Far better, if things are complex at all, is to manage that from a single routine, which can usually do what you need with a couple of well-chosen state flags. )
 
This might help you:

make a timer called chk
set its interval to 1
make sure enabled is set to true
put this code in the chk sub
remember the first in a list is zero


If combo1.listindex = 0 thrn
text1.visable = true
ElseIf combo1.listindex <> 0 then
text1.visiable = False

that way or some way simular is the way i do it
 
This might help you:

make a timer called chk
set its interval to 1
make sure enabled is set to true
put this code in the chk sub
remember the first in a list is zero


If combo1.listindex = 0 thrn
text1.visable = true
ElseIf combo1.listindex <> 0 then
text1.visiable = False
end if
that way or some way simular is the way i do it
 
This might help you:

make a timer called chk
set its interval to 1
make sure enabled is set to true
put this code in the chk sub
remember the first in a list is zero


If combo1.listindex = 0 thrn
text1.visable = true
ElseIf combo1.listindex <> 0 then
text1.visiable = False
end if
that way or some way simular is the way i do it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top