This topic is locked

disable or enable a dropdown based on the selection from another dropd

8/9/2008 11:32:45 AM
PHPRunner General questions
E
emsurban author

how can you disable or enable a dropdown based on the selection from another dropdown.
For example:
1 dropdown
Please select...

Test1

Test2

Test3
the second dropdown is dependent on the selection i made on first dropdown. If i select Test1 or Test2 2nd dropdown will be disabled, however if I select Test3 2nd dropdown will be enabled.
I not using table to store choices in my dropdown, i have manually inputted the choices.
Thanks in advance..

T
thesofa 8/10/2008

OK, here is a way, first get the value chosen in the drop down using the &$values array in the events.

if value (dropdown) is test1

disable dropdown 2

if value(dropdown) is test2

disable dropdown 2

if value(dropdown) is test3,

enable dropdown2
or better still, on loading the page, set dropdown2 as disabled by default

if value(dropdown) is test3,

enable dropdown2
search here for the code to show/hide or enable/disable drop down controls
HTH

E
emsurban author 8/10/2008

OK, here is a way, first get the value chosen in the drop down using the &$values array in the events.

if value (dropdown) is test1

disable dropdown 2

if value(dropdown) is test2

disable dropdown 2

if value(dropdown) is test3,

enable dropdown2
or better still, on loading the page, set dropdown2 as disabled by default

if value(dropdown) is test3,

enable dropdown2
search here for the code to show/hide or enable/disable drop down controls
HTH


cool... what event will be triggered if selections is made on a combo box?

T
thesofa 8/10/2008

OK, try a different route instead, drop1 has values of t1, t2, t3

drop 2 comes from a table of values, but only if drop1 shows T3?

correct?

OK, make drop 2 dependant on drop1 and have a where clause in the conditions for drop2 of where value drop1=t3???
That should work

OR, add a field to the table for drop2 that has a value of T3 in all the field rows and make that field the link to drop1
Tell me what the fields are and I will try to throw somewthing together to show you

J
Jane 8/11/2008