Hi all....
I have a contact form within a div that displays like a sliding panel when the 'contact us' link is clicked (by default, the div does not display when the page loads).
I've added a captcha function (classic asp) to validate the form on submit. The captcha function checks the 'captcha code' before sending the form data in an email.
If a visitor enters an incorrect captcha code, a text warning is displayed within the div. The problem is when the page is submitted, the div revets back to it's default state (css display none)
How would i get the div to stay displayed if the captcha code was incorrent?
here's the code i'm using
css
JavascriptCode:#contact_panel { height: 215px; background-image: url(../../assets/img/panel_slide_bg.gif); background-repeat: no-repeat; width: 341px; background-position: center top; position: absolute; z-index: 50; margin-top: 0px; margin-left: 9px; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; text-decoration: none; padding-top: 20px; padding-right: 12px; padding-bottom: 10px; padding-left: 11px; background-color: #C9CACA; border: 1px solid #BBBBBB; }
Link to open div sliderCode:<script type="text/javascript"> $(document).ready(function(){ $(".btn-slide1").click(function(){ $("#contact_panel").slideToggle("slow"); $(this).toggleClass("active"); return false; }); }); </script>
Div containing formCode:<div class="contact_slide"><a href="#" class="btn-slide1"></a></div>
Code:<div id="contact_panel"> <!-- you can put content here --> <form action="#" method="post" name="infoform" id="infoform"> <div> <p>Please enter your details so we can provide you with further information about the " <%=(RSDetails.Fields.Item("Product").Value)%>" <input name="subject" type="hidden" id="subject" value="product information enquiry" /> <input name="product" type="hidden" id="product" value="<%=(RSDetails.Fields.Item("Product").Value)%>" /> </p> <table width="100%" border="0" cellspacing="2" cellpadding="5"> <tr> <td width="25%"><div align="right">Name</div></td> <td width="75%"><div align="left"> <label> <input name="name" type="text" id="name" /> </label> </div></td> </tr> <tr> <td><div align="right">Company</div></td> <td><div align="left"> <label> <input name="company" type="text" id="company" /> </label> </div></td> </tr> <tr> <td><div align="right">Telephone</div></td> <td><div align="left"> <label> <input name="telephone" type="text" id="telephone" /> </label> </div></td> </tr> <tr> <td><div align="right">Email</div></td> <td><div align="left"> <label> <input name="email" type="text" id="email" /> </label> </div></td> </tr> <tr> <td><div align="right">Message</div></td> <td><div align="left"> <label> <textarea name="message" rows="4" id="message"></textarea> </label> </div></td> </tr> <tr> <td> </td> <td><img id="imgCaptcha" src="captcha.asp" /><br /> <a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')">Change Security Code </a></td> </tr> <tr> <td><div align="right">Enter Code </div></td> <td><input name="captchacode" type="text" id="captchacode" size="22" maxlength="6" /> <% if not IsEmpty(Request.Form("btnTest")) then Response.Write("<tr><td colspan=""2"" align=""center"">") if not TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then Response.Write("<b style=""color:#FF0000"">Wrong Security Code Entered</b>") end if Response.Write("</td></tr>" & vbCrLf) end if %> </td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left"> <label> <input name="btnTest" id="btnTest" type="submit" value="Submit" /> </label> <input name="FFinfosubmit" type="hidden" id="FFinfosubmit" value="yes" /> </div></td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left"></div></td> </tr> </table> </div> </form> </div>


Reply With Quote
Bookmarks