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;' />";
} ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.