Mfrwc: Difference between revisions

From SWCP Support Wiki
Jump to navigationJump to search
No edit summary
Line 4: Line 4:
will require '''your website users to have Javascript enabled''' in order to work.
will require '''your website users to have Javascript enabled''' in order to work.


==Including the Javascript File===
==Including the Javascript File==
In the HEAD section of your HTML you need to include a Javascript file. See below:
In the HEAD section of your HTML you need to include a Javascript file. See below:


Line 11: Line 11:
           src="http://captcha.swcp.com/ajax_captcha.js">
           src="http://captcha.swcp.com/ajax_captcha.js">
   </script>
   </script>
 
  </PRE>


==Action Buttons==
==Action Buttons==
Line 17: Line 17:
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.
====CSS====
====CSS====
  <PRE>
   &lt;style = "text/style"&gt;
   &lt;style = "text/style"&gt;
   #imgCaptcha { margin: 0 30px; border: black solid 1px; }
   #imgCaptcha { margin: 0 30px; border: black solid 1px; }
   &lt;/style&gt;
   &lt;/style&gt;
  </PRE>
====Picture and input field====
====Picture and input field====
  <PRE>
   &lt;img id="imgCaptcha" src='/cgi-bin/gencap.pl?789'&gt;&lt;br>&lt;br&gt;
   &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
         &lt;INPUT id="txtCaptcha" TYPE="text" name="verify" size=8
         &lt;INPUT id="txtCaptcha" TYPE="text" name="verify" size=8
                 onKeyPress="onlyOnReturn(event, document.mfrwc)"; &gt;&lt;br&gt;
                 onKeyPress="onlyOnReturn(event, document.mfrwc)"; &gt;&lt;br&gt;
  </PRE>


===A button to get a new CAPTCHA===
===A button to get a new CAPTCHA===
This is in case the generated CAPTCHA isn't readable by the client, they can
This is in case the generated CAPTCHA isn't readable by the client, they can
use this to get a different one. This is an optional button.
use this to get a different one. This is an optional button.
  <PRE>
   &lt;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)";&gt;
         NAME="regCaptcha" onclick="regenCaptcha(document.mfrwc)";&gt;
  </PRE>


===Submit Replacement===
===Submit Replacement===
This is required. Do not change the id or name of this button.
This is required. Do not change the id or name of this button.
  <PRE>
   &lt;INPUT id="btnCaptcha" type="button" value="Send Comments"
   &lt;INPUT id="btnCaptcha" type="button" value="Send Comments"
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)";&gt;
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)";&gt;
  </PRE>
===Clear Form Button===
===Clear Form Button===
This is also optional.
This is also optional.
  <PRE>
   &lt;INPUT TYPE="reset" VALUE="Clear Form"&gt;
   &lt;INPUT TYPE="reset" VALUE="Clear Form"&gt;
  </PRE>


===Status Area===
===Status Area===
This empty DIV is needed to display an error message when the user types in an
This empty DIV is needed to display an error message when the user types in an
incorrect CAPTCHA text.
incorrect CAPTCHA text.
  <PRE>
   &lt;DIV id="response"&gt; &nbsp &lt;/DIV&gt;
   &lt;DIV id="response"&gt; &nbsp &lt;/DIV&gt;
   </PRE>
   </PRE>

Revision as of 18:14, 10 February 2009

First read the information on mail-form-results for detailed description of all the necessary field names. Below are the additional fields and include files that you'll need for using mfrwc (Mail form results with CAPTCHA). Please note that this form will require your website users to have Javascript enabled in order to work.

Including the Javascript File

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>
   

Action Buttons

Generating the CAPTCHA picture

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

CSS

  <style = "text/style">
  #imgCaptcha { margin: 0 30px; border: black solid 1px; }
  </style>
  

Picture and input field

  <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>
  

A button to get a new CAPTCHA

This is in case the generated CAPTCHA isn't readable by the client, they can use this to get a different one. This is an optional button.

  <INPUT id="regCaptcha" type="button" value="Give me different text"
         NAME="regCaptcha" onclick="regenCaptcha(document.mfrwc)";>
  

Submit Replacement

This is required. Do not change the id or name of this button.

  <INPUT id="btnCaptcha" type="button" value="Send Comments"
         NAME="btnCaptcha" onclick="getParam(document.mfrwc)";>
  

Clear Form Button

This is also optional.

  <INPUT TYPE="reset" VALUE="Clear Form">
  

Status Area

This empty DIV is needed to display an error message when the user types in an incorrect CAPTCHA text.

  <DIV id="response"> &nbsp </DIV>
  


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.