Skip navigation
Rcain37
Currently Being Moderated

Making a Submit Button Appear

Dec 12, 2006 7:55 AM

I have a form that people have been filling out and submitting into our database. I would like to add a checkbox that says "if the user agrees that their information is correct check this box". After they check the box I want the submit button to appear. Does anyone have suggestions on this? The form works properly now but I want the user to check the box before they can submit the form.

Thanks
 
Replies
  • Currently Being Moderated
    Dec 12, 2006 7:58 AM   in reply to Rcain37
    Take a look at this:
    http://www.dynamicdrive.com/dynamicindex16/acceptterm.htm
    HTH
    --
    Tim Carley
    www.recfusion.com
    info@NOSPAMINGrecfusion.com
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 12, 2006 8:38 AM   in reply to Rcain37
    To make it easy so others don't need to go digging:

    There are two ways of doing it. You can make the button appear and disappear like this:

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function checkButton() {
    if (document.TestForm.boxOnOff.checked) {
    document.TestForm.Submit1.style.display="block";
    } else {
    document.TestForm.Submit1.style.display="none";
    }
    return true;
    }
    </SCRIPT>
    </HEAD>
    <BODY onLoad="document.TestForm.Submit1.style.display='none';">
    <FORM NAME="TestForm" METHOD="POST" ACTION="nextfile.html">
    <INPUT TYPE="CHECKBOX" NAME="boxOnOff" onChange="checkButton();"><BR>
    <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="Submit">
    </FORM>
    </BODY>
    </HTML>

    Or you can enable and disable the button, which I prefer. Users tend to get confused when buttons appear or disappear. Graying them out and enabling them after the fact gives people more of a "warm-fuzzy" feeling. Same code as above, with some modification:

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function checkButton() {
    if (document.TestForm.boxOnOff.checked) {
    document.TestForm.Submit1.disabled=false;
    } else {
    document.TestForm.Submit1.disabled=true;
    }
    return true;
    }
    </SCRIPT>
    </HEAD>
    <BODY onLoad="document.TestForm.Submit1.disabled=true;">
    <FORM NAME="TestForm" METHOD="POST" ACTION="nextfile.html">
    <INPUT TYPE="CHECKBOX" NAME="boxOnOff" onChange="checkButton();"><BR>
    <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="Submit">
    </FORM>
    </BODY>
    </HTML>
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points