Need help with Capcha


i need website design , have form using spry validation want put in capcha.  happening can either spry validate or capcha if either 1 of them push form through without information need.  great.  here code

<body>

<div align="center">

  <p><img src="images/haysville fall festival logo small.png" width="151" height="153" /></p>

  <h1><strong>booth registration</strong></h1>

  <form action="booth.php" method="post" enctype="multipart/form-data" name="form1" id="booth form">

    <div align="left">

      <h4>booth type:      <span id="spryselect1">

        <label for="type"></label>

        <select name="type" id="type">

          <option selected="selected">select booth type</option>

          <option value="commercial">commercial</option>

          <option value="craft">craft</option>

          <option value="civic">civic</option>

        </select>

      <span class="selectrequiredmsg">please select item.</span></span></h4>

      <h4>contact person:

        <span id="sprytextfield1">

        <input name="contact" type="text" id="contact name:" />

      </span> </h4>

      <h4>business name:

        <span id="sprytextfield2">

        <input name="business" type="text" id="business name:" />

        </span> </h4>

      <h4>description of booth contents:

        <span id="sprytextfield3">

        <input type="text" name="contents" id="contents" />

        </span> </h4>

      <h4>

 

        <label for="mailing address:">mailing address:</label>

        <span id="sprytextfield4">

        <input name="address" type="text" id="mailing address:" />

        </span>

        <label for="city:">city:</label>

        <span id="sprytextfield5">

        <input name="city" type="text" id="city:" />

        </span> state:

        <span id="sprytextfield6">

        <input name="state" type="text" id="state" />

        </span>

<label for="zip:">zip:</label>

<span id="sprytextfield7">

<input name="zip" type="text" id="zip:" size="5" maxlength="5" />

<span class="textfieldinvalidformatmsg">invalid format.</span></span></h4>

      <h4>phone number:

        <span id="sprytextfield8">

        <input name="phone" type="text" id="phone number:" />

        <span class="textfieldinvalidformatmsg">invalid format.</span></span> </h4>

      <h4><span id="sprytextfield11">

        <label for="email">email address:</label>

        <input type="text" name="email" id="email" />

        <span class="textfieldinvalidformatmsg">invalid format.</span></span></h4>

      <h4>kansas state tax number (or ss#):

        <span id="sprytextfield9">

        <input name="tax" id="kansas statetax number (or ss#):" />

        </span> </h4>

      <h4>number of spaces:

        <span id="sprytextfield10">

        <input name="spaces" type="text" id="number of spaces:" size="10" maxlength="2" />

      <span class="textfieldrequiredmsg"></span><span class="textfieldinvalidformatmsg">invalid format.</span></span>       @ $40.00 each. </h4>

      <h4>i need electricity hook-up for:

        <input name="electricity" type="text" id="electricity" size="10" maxlength="2" />

      @ $10.00 per space. (very limited availability)</h4>

      <h4>all federal, state, , local laws governing retail sales tax must followed. understand rules , regulations of show , comply. realize failure comply may result in expulsion show. hereby release , discharge haysville fall festival committee , liability damages or injuries myself , personal property or person during festival. have read , understand rules , regulation set forth haysville fall festival.</h4>

      <h5><span id="sprycheckbox1">

        <label for="agree"></label>

        <input type="checkbox" name="agree" id="agree" />

      <span class="checkboxrequiredmsg">please make selection.</span></span><em>by checking box agree terms , regulations lined out haysville fall festival committee.</em></h5>

      <h6 align="center">i receive information other craft shows:

        <label>

          <input name="craft" type="radio" value="yes" id="radiogroup1_0" />

        yes</label>

        <label>

          <input name="craft" type="radio" value="no" id="radiogroup1_1" />

          no. (by checking yes giving permission haysville fall festival give information other craft shows ask list.)</label>

        <br />

      </h6>

  <label for="code">write code below<span id="txtcaptchadiv" style="color:#f00"></span><!-- script place generated code --><input type="hidden" id="txtcaptcha" /></label><!-- script place copy of code validation: hidden field -->

    <input type="text" name="txtinput" id="txtinput" size="30" /></p>

    </fieldset><fieldset class="last"></fieldset></p>

<p align="right">

  <input type="reset" name="reset" id="reset" value="reset" />

        <input name="button" type="submit" id="button" onclick="mm_calljs('booth.js')" value="proceed payment" />

  </p>

</div>

</form>

<script type="text/javascript">

//generates captcha function  

    var = math.ceil(math.random() * 9)+ '';

    var b = math.ceil(math.random() * 9)+ '';     

    var c = math.ceil(math.random() * 9)+ '';

    var d = math.ceil(math.random() * 9)+ '';

    var e = math.ceil(math.random() * 9)+ '';

    var code = + b + c + d + e;

    document.getelementbyid("txtcaptcha").value = code;

    document.getelementbyid("txtcaptchadiv").innerhtml = code;

</script>

<script type="text/javascript">

function checkform(theform){

    var why = "";

 

 

    if(theform.txtinput.value == ""){

        why += "- security code should not empty.\n";

    }

    if(theform.txtinput.value != ""){

        if(validcaptcha(theform.txtinput.value) == false){

            why += "- security code did not match.\n";

        }

    }

    if(why != ""){

        alert(why);

        return false;

    }

}

// validate entered input aganist generated security code function 

function validcaptcha(){

    var str1 = removespaces(document.getelementbyid('txtcaptcha').value);

    var str2 = removespaces(document.getelementbyid('txtinput').value);

    if (str1 == str2){

        return true;  

    }else{

        return false;

    }

}

// remove spaces entered , generated code

function removespaces(string){

    return string.split(' ').join('');

}

</script>

<script type="text/javascript">

var sprytextfield1 = new spry.widget.validationtextfield("sprytextfield1", "none", {validateon:["change"]});

var sprytextfield2 = new spry.widget.validationtextfield("sprytextfield2", "none", {validateon:["change"]});

var sprytextfield3 = new spry.widget.validationtextfield("sprytextfield3", "none", {validateon:["change"]});

var sprytextfield4 = new spry.widget.validationtextfield("sprytextfield4", "none", {validateon:["change"]});

var sprytextfield5 = new spry.widget.validationtextfield("sprytextfield5", "none", {validateon:["change"]});

var sprytextfield6 = new spry.widget.validationtextfield("sprytextfield6", "none", {validateon:["change"]});

var sprytextfield7 = new spry.widget.validationtextfield("sprytextfield7", "zip_code", {validateon:["change"]});

var sprytextfield8 = new spry.widget.validationtextfield("sprytextfield8", "phone_number", {validateon:["change"]});

var sprytextfield9 = new spry.widget.validationtextfield("sprytextfield9", "none", {validateon:["change"]});

var sprytextfield10 = new spry.widget.validationtextfield("sprytextfield10", "integer", {validateon:["change"]});

var spryselect1 = new spry.widget.validationselect("spryselect1");

var sprycheckbox1 = new spry.widget.validationcheckbox("sprycheckbox1");

var sprytextfield11 = new spry.widget.validationtextfield("sprytextfield11", "email", {isrequired:false, validateon:["change"]});

</script>

  <h6 align="left"><a href="index.html">return home</a></h6>

</div>

</body>

two things. 

 

#1 captchas

i don't believe in using captchas.  difficult read, not web friendly & lead more form submission failures successes.  captchas should used last resort after else has been exhausted.  

 

my favorite way block spam bots use "honeypot" or hidden field technique.  spam bots stupid, can't resist filling out form fields, hidden ones.  if field contains characters, form processing script aborts , never see spam.  effective , kinder humans.

 

#2  spry validation

spry works if javascript enabled in browsers.  if isn't, form pass through without validation whatsoever.

 

instead of spry, recommend using html5 forms along server-side validation in form processing script. 

http://www.adobe.com/devnet/dreamweaver/articles/html5-forms-pt1.html

 

 

 

nancy o.



More discussions in Dreamweaver support forum


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account