Checkbox to clear a form

Results 1 to 2 of 2

Thread: Checkbox to clear a form

  1. #1
    Join Date
    Dec 1969

    Default Checkbox to clear a form

    I have this form:<BR><BR><BR>I would like to clear all the boxes when a user unchecks the box. If possible I would like to re-instate the values when they check the box again. <BR><BR>The initial values are populated from a cookie if they have chosen to save their details.<BR><BR>Is there a way to do this using JavaScript, client side?<BR><BR>Thanks,<BR>Jamie

  2. #2
    Join Date
    Dec 1969

    Default RE: Checkbox to clear a form

    Ok, there are a few things to clear up here.<BR><BR>Clicking a checkbox to clear a form, that&#039;s feasible. But...<BR>What do you seek? <BR>Delete all values : Will require a javascript function<BR> or <BR>Put the fields back to their original values when the page loaded? : Onclick="form.reset()"<BR><BR>Re-instate the values when they check the box again?<BR><BR>Well you have two choices, save all values to hidden fields or reload the page and let the page read the cookie.<BR><BR>Save all values (and read them later) : Will require one or more javascript function<BR><BR>Reload the page : OnClick="window.location.reload()"<BR><BR>(Of course you&#039;ll need to code around to determine if the checkbox is checked or not)<BR><BR>Stephane Dorion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts