html question (check box)

Discussion in 'HTML' started by lrbtav@gmail.com, Oct 23, 2006.

  1. Guest

    Hi, I have a site with a built in 'contact us' form; how can I force
    the user to check a certain check box before allowing them to submit
    the form? This site is hosted on an ASP enabled godaddy server, but I
    figured there was some html or js function that would accomplish this.
    Thanks
    , Oct 23, 2006
    #1
    1. Advertising

  2. Nico Schuyt Guest

    wrote:
    > Hi, I have a site with a built in 'contact us' form; how can I force
    > the user to check a certain check box before allowing them to submit
    > the form? This site is hosted on an ASP enabled godaddy server, but I
    > figured there was some html or js function that would accomplish this.


    HTML: impossible
    JS: unreliable
    Handle it in ASP after the form is submitted

    --
    Nico Schuyt
    http://www.nicoschuyt.nl/
    Nico Schuyt, Oct 23, 2006
    #2
    1. Advertising

  3. Rik Guest

    Nico Schuyt wrote:
    > wrote:
    >> Hi, I have a site with a built in 'contact us' form; how can I force
    >> the user to check a certain check box before allowing them to submit
    >> the form? This site is hosted on an ASP enabled godaddy server, but I
    >> figured there was some html or js function that would accomplish
    >> this.

    >
    > HTML: impossible
    > JS: unreliable
    > Handle it in ASP after the form is submitted


    Well, TRY to handle it with JS, but make sure of it on the server. It saves
    a lot users an unneccessary trip to the server, get the contents, load the
    page, just to get the error that he forgot to check a box after.
    --
    Rik Wasmus
    Rik, Oct 24, 2006
    #3
  4. Guest

    In the form tag add an onsubmit which calls a JavaScript function to
    check whether your checkbox is actually checked. If it isn't return
    false with a message of some kind. If it is checked, return true and
    then (as others have said) check via ASP to ensure the box was checked.

    Easy enough.. :)


    On Oct 22, 6:47 pm, wrote:
    > Hi, I have a site with a built in 'contact us' form; how can I force
    > the user to check a certain check box before allowing them to submit
    > the form? This site is hosted on an ASP enabled godaddy server, but I
    > figured there was some html or js function that would accomplish this.
    > Thanks
    , Oct 24, 2006
    #4
  5. Nico Schuyt Guest

    Rik wrote:
    > Nico Schuyt wrote:
    >> wrote:
    >>> Hi, I have a site with a built in 'contact us' form; how can I force
    >>> the user to check a certain check box before allowing them to submit
    >>> the form? This site is hosted on an ASP enabled godaddy server, but
    >>> I figured there was some html or js function that would accomplish
    >>> this.


    >> HTML: impossible
    >> JS: unreliable
    >> Handle it in ASP after the form is submitted


    > Well, TRY to handle it with JS, but make sure of it on the server.
    > It saves a lot users an unneccessary trip to the server, ...


    But makes things unneccessary complex due to the double validation :)

    --
    Nico Schuyt
    http://www.nicoschuyt.nl/
    Nico Schuyt, Oct 24, 2006
    #5
  6. Guest

    To use a JS function, would something like this work:

    function checkscript() {
    if (window.document.form.BoxChecked.checked=false) {
    alert('Warning: Please agree to our terms of service.');
    return false;
    }
    else if (window.document.form.BoxChecked.checked=true) {
    alert('Thank you for your business!');
    return true;
    }

    ? thanks
    , Oct 27, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mit
    Replies:
    1
    Views:
    803
    Ramu Pulipati
    Jan 25, 2006
  2. ashutosh
    Replies:
    3
    Views:
    8,992
    Andrew Thompson
    Jun 16, 2005
  3. Gnarlodious
    Replies:
    4
    Views:
    17,586
    elizas
    May 5, 2010
  4. Jim

    Check box and text box disable

    Jim, Jun 3, 2004, in forum: Javascript
    Replies:
    3
    Views:
    118
    Randy Webb
    Jun 4, 2004
  5. babu17
    Replies:
    1
    Views:
    136
Loading...

Share This Page