Mfrwc: Difference between revisions

From SWCP Support Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 5: Line 5:


   <PRE>
   <PRE>
   &ltscript language="JavaScript" type="text/javascript"  
   &lt;script language="JavaScript" type="text/javascript"  
           src="http://captcha.swcp.com/ajax_captcha.js"&gt
           src="http://captcha.swcp.com/ajax_captcha.js"&gt;
   &lt/script&gt
   &lt;/script&gt;


At the end of your form replace the Submit button with the following code:
At the end of your form replace the Submit button with the following code:
   <style = "text/style">
   &lt;style = "text/style"&gt;
   #imgCaptcha { margin: 0 30px; border: black solid 1px; }
   #imgCaptcha { margin: 0 30px; border: black solid 1px; }
   </style>
   &lt;/style&gt;
   <img id="imgCaptcha" src='/cgi-bin/gencap.pl?789'><br><br>
   &lt;img id="imgCaptcha" src='/cgi-bin/gencap.pl?789'&gt;&lt;br>&lt;br&gt;
   Please type in the letters above
   Please type in the letters above
         <INPUT id="txtCaptcha" TYPE="text" name="verify" size=8
         &lt;INPUT id="txtCaptcha" TYPE="text" name="verify" size=8
                 onKeyPress="onlyOnReturn(event, document.mfrwc)"; ><br>
                 onKeyPress="onlyOnReturn(event, document.mfrwc)"; &gt;&lt;br&gt;
   <INPUT id="regCaptcha" type="button" value="Give me different text"
   &lt;INPUT id="regCaptcha" type="button" value="Give me different text"
         NAME="regCaptcha" onclick="regenCaptcha(document.mfrwc)"; >
         NAME="regCaptcha" onclick="regenCaptcha(document.mfrwc)";&gt;
   <INPUT id="btnCaptcha" type="button" value="Send Comments"
   &lt;INPUT id="btnCaptcha" type="button" value="Send Comments"
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)"; >
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)";&gt;
   <INPUT TYPE="reset" VALUE="Clear Form">
   &lt;INPUT TYPE="reset" VALUE="Clear Form"&gt;
   < DIV id="response" > &nbsp < /DIV >
   &lt;DIV id="response"&gt; &nbsp &lt;/DIV&gt;


The CSS is to indent the CAPTCHA and draw a thin black line around it. This is completely optional.
The CSS is to indent the CAPTCHA and draw a thin black line around it. This is completely optional.

Revision as of 17:42, 10 February 2009

THIS PAGE IS UNDER DEVELOPMENT. PLEASE COME BACK SOON.

The setup for mfrwc is the same as mail-form-results, with two additional sections. In the HEAD section of your HTML you need to include a Javascript file. See below:

  <script language="JavaScript" type="text/javascript" 
           src="http://captcha.swcp.com/ajax_captcha.js">
  </script>

At the end of your form replace the Submit button with the following code:
  <style = "text/style">
  #imgCaptcha { margin: 0 30px; border: black solid 1px; }
  </style>
  <img id="imgCaptcha" src='/cgi-bin/gencap.pl?789'><br><br>
  Please type in the letters above
         <INPUT id="txtCaptcha" TYPE="text" name="verify" size=8
                 onKeyPress="onlyOnReturn(event, document.mfrwc)"; ><br>
  <INPUT id="regCaptcha" type="button" value="Give me different text"
         NAME="regCaptcha" onclick="regenCaptcha(document.mfrwc)";>
  <INPUT id="btnCaptcha" type="button" value="Send Comments"
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)";>
  <INPUT TYPE="reset" VALUE="Clear Form">
  <DIV id="response"> &nbsp </DIV>

The CSS is to indent the CAPTCHA and draw a thin black line around it. This is completely optional.
Note, the ids and the DIV are used by the Captcha scripts and must remain with the same names.
The 'regCaptcha' button is for allowing the form user to regenerate a new text if they can't read the
one that's presented.

Complete example with all necessary variables
The values on the INPUT buttons can be changed to anything you'd like. The empty DIV named response is
used to present an error message when the CAPTCHA is incorrectly typed and must be there.