6 Replies Latest reply: Jul 31, 2012 8:57 PM by R-Co RSS

    Spry form validation not working

    R-Co Community Member

      I have a simple form with only 5 fields. All fields are required and I've added the Spry Validation Text Fields and a Spry Validation Text Area. Dreamweaver installed the appropriate css and .js files. The validation isn't working, though. I can leave every field blank and the form will submit. I'm also using Captcha to process the form, so I'm wondering if there's some sort of conflict with the captcha code, although I did another form with Spry validation and captcha and it works just fine. I've checked the code on the new form with the other form that works and they're essentially the same. I've tried it both with and without the "onsubmit" in the form tag. The code for the form is below. Any help would be appreciated.






      <form action="http://www.SnapHost.com/captcha/send.aspx" method="post" id="contactform"  onsubmit="return ValidateForm(this);">


      <input type="hidden" id="skip_WhereToSend" name="skip_WhereToSend"

      value="info@mydomain.com" />

      <input type="hidden" id="skip_Subject" name="skip_Subject"

      value="Message from web site" />

      <input type="hidden" id="skip_WhereToReturn" name="skip_WhereToReturn"

      value="mydomain.com/thank_you.html" />

      <input type="hidden" id="skip_SnapHostID" name="skip_SnapHostID"

      value="YZQN5AYCB68N" />


      <p class="left">

      <label for="name">Name:</label>

      <span id="sprytextfield1">

      <input type="text" name="name" id="name" tabindex="10" />

      <span class="textfieldRequiredMsg">Name is required</span></span></p>


      <p class="right">

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

      <span id="sprytextfield2">

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

      <span class="textfieldRequiredMsg">Email is required</span><span class="textfieldInvalidFormatMsg">Invalid format</span></span></p>


      <p class="left">

      <label for="phone">Phone:</label>

      <span id="sprytextfield3">

      <input type="text" name="phone" id="phone" tabindex="30" />

      <span class="textfieldRequiredMsg">Phone number is required</span><span class="textfieldInvalidFormatMsg">Invalid format</span></span></p>


      <p class="right">

      <label for="TypeLoan">Type of Loan:</label>

      <span id="sprytextfield4">

      <input type="text" name="TypeLoan" id="TypeLoan" tabindex="40" />

      <span class="textfieldRequiredMsg">Required</span></span></p>



      <label for="message">Please provide details, including loan amount:</label>

      <span id="sprytextarea1">

      <textarea name="message" id="message" cols="45" rows="5" tabindex="50"></textarea>

      <span class="textareaRequiredMsg">Details required</span></span></p>


      <div id="captcha">


      <div id="captcha_text">

      <a href="http://www.SnapHost.com/captcha/ProCaptchaOverview.aspx">

      <p style="text-decoration:none; font-family:Trebuchet MS, Arial, Helvetica, sans-serif; font-size:10px; color:#2a2925; margin-bottom:0; padding-bottom:0;">This web form is protected from SPAM by SnapHost.com</p></a></div>


      <div id="captcha_code">

      <a href="#" onclick="return ReloadCaptchaImage('CaptchaImage');"><span style="text-decoration:none; font-family:Trebuchet MS, Arial, Helvetica, sans-serif; font-size:10px; color:#2a2925;">reload image</span></a><br />

      <a href="http://www.SnapHost.com/captcha/"><img id="CaptchaImage"

      alt="Captcha Code" style="border-width:0px; margin-bottom:16px"

      title="This Captcha image is intended to prevent spam. The Captcha code is generated by an online form processor. To submit this form, enter the code into the text field. For more information click on the Captcha image."

      src="http://www.SnapHost.com/captcha/CaptchaImage.aspx?id=YZQN5AYCB68N" /></a>


      <div id="captcha_field">  <span style="text-decoration:none; font-family:Trebuchet MS, Arial, Helvetica, sans-serif; font-size:10px; color:#2a2925;">Enter Captcha code</span><br />

      <input id="skip_CaptchaCode" name="skip_CaptchaCode" type="text"

      style="width:100px; padding:11px; margin-left:0; margin-bottom: 24px; font-size:14px;" maxlength="6"  />




      <script type="text/javascript">

      function ReloadCaptchaImage(captchaImageId) {

      var obj = document.getElementById(captchaImageId);

      var src = obj.src;

      var date = new Date();

      var pos = src.indexOf('&rad=');

      if (pos >= 0) { src = src.substr(0, pos); }

      obj.src = src + '&rad=' + date.getTime();

      return false; }



      <input name="skip_submit" type="submit" class="submit" value="SUBMIT" style="margin-bottom:33px; " />