Jump to content

Greying out options in a form dynamically


davidkk

Recommended Posts

I'm setting up a form for my uncle on his website to accept online checks. We have a HTML form that passes through php and one of the options is a radio button with the option for either personal or organizational. What I am trying to do (and not sure whether it would be through javascript or heck even css but..) is when ever the organization's check is selected the box for drivers license is greyed out, so you can only enter information in the drivers license field when personal check is selected on the radio button.

Thanks in advance.

-Dave

  • 2 weeks later...

This would be done using javascript, not sure on the exact code, however if you use the OnClick event, you could do it like this

 

 

<script language="javascript">

function disable()
{
document.form.field.disabled=true;
}
</script>

<input type=radio value="x" OnClick="disable()">

 

This should be moved to the javascript section

 

//Granted, I dont know if this will work, but it should get you headed in the right direction

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.