Link to home
Start Free TrialLog in
Avatar of Errol Farro
Errol FarroFlag for Aruba

asked on

Coldfusion: Block certain fields based on input field

I have a form with 7 fields (fields 1 thru 7). If field1=A, fields 2, 3 and 4 should be blocked and fields 5, 6 and 7 can be entered. If field1=B, the other side around, fields 2, 3 and 4 can be entered and fields 5,6 and 7 blocked.

How can I accomplish this in coldfusion?

Thanks.

Errol
ASKER CERTIFIED SOLUTION
Avatar of stu215
stu215
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mihaimm
mihaimm

Also remember validate on server side as java script can be easily disabled and you can't do anything about it. In case something is invalid, return to the page with an error message.
Avatar of Errol Farro

ASKER

I tried your code and it worked fine with the radio button but actually I have a drop down list with 5 values.
If the field is value1 then it should do part 1, else it should do part 2. I don't know scripting very well. How do I do I change the if line ( if (document.form1.radio1[0].checked==true)) to handle a drop down field?

Thanks. Errol
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey,

Doh, had a busy morning @ work but yep, what mihaimm put should work for a drop down.

~Stu :-)
Thanks a lot for your help Guys. It's working. Regards. Errol