Jump to content

Retaining disabled check boxes on refresh


Eiolon

Recommended Posts

I have a page with a series of check boxes.  If one in particular is checked, it will disable the other ones.

 

There are other fields on the page.  When the fields are validated and an error occurs, the check box remains checked but it does not keep the other ones disabled.

 

Here is what I am using for my code:

 

	<?php if ($_POST['no_registration_required'] == "1") {
echo "<input name='no_registration_required' type='checkbox' id='no_registration_required' value='1' onclick='this.form.allow_online_registration.disabled = this.checked; this.form.ask_age.disabled = this.checked; this.form.ask_address.disabled = this.checked; this.form.ask_source.disabled = this.checked; this.form.fee_required.disabled = this.checked;' checked='checked' />";
} else {
echo "<input name='no_registration_required' type='checkbox' id='no_registration_required' value='1' onclick='this.form.allow_online_registration.disabled = this.checked; this.form.ask_age.disabled = this.checked; this.form.ask_address.disabled = this.checked; this.form.ask_source.disabled = this.checked; this.form.fee_required.disabled = this.checked;' />";
} ?>

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.