User Tools

Site Tools


dev:webmaster:form_mail_template_captcha

Lookafter Form-To-Mail Template with Captcha Support

This form can be used by Lookafter customers to create contact or feedback form on their website, which will send all collected information to the target email address.

Important Notes:

  • This form is designed to Lookafter customers only.
  • This form must submit to a valid email address that is hosted with Lookafter.
  • jquery.js must be included in the html in order to support the captcha display.

Form Action

The form action looks like below.

<FORM action="https://vo.agnx.com/cgi-bin/vo/formmail.cgi.vo" method="post">

Fields

Field NameDescription
_formFromShow in the FROM: section of the email
_formSubjectSubject of email: The date & time stamp [datetime] will be replaced with the form submission date and time. [formRef] is a unique number genereted for the email, good for tracking use
_formToEmail for this form to send to. You can turn this to hidden field if you are sending this form to a permanent address. Separate each email with “,”
_formOutputTemplateThe field/value format in email. By default, this is set to:
[<field>]<br><value><br><br>
You can change the format easily to:
<field>: <value><br><br>
if you would like to have the field name and value stay in one line.
Note that only 3 keywords are supported: <field>, <value> and <br>
_formOutputTemplate_headerThe text to insert at the begining of the email
_formOutputTemplate_footerThe text to insert at the end of the email
_form_contenttypeThe MIME email content type. “text” or “html” allow, default “text”. Good to set it to “html” if you have formated the form format to html
_formNextWhere do you want to go after this form submitted.
After a successful post, where do you want to bring the user to next? Specify the URL here (eg: http://www.mysite.com).
Skip this if you wish to use the default.
_formErrWhat do you want to show if this form has some incomplete entry (eg: http://www.mysite.com/error.htm).
Skip this if you wish to use internal error handling
_formCleanFieldNameUse in pair with mandatory field name. Don't show the tilt “~” in mandatory field name if checked. Eg: ~name will become name in email
_formVoidNumDon't show the number prefix in field name if checked, eg: 1, name will be shown as name in email
_formAllFieldAll field wanted; checked if you want the user to fill-up all the fields
_form_custom_headerThe additional MIME header to insert into the email. Usually not require. Format in Key: Data (eg: To: online@domain.tld)
_formDateFormatThe custom date format. Available: YYYY (4 digits year), YY (2 digits year), MM (2 digits month), M (single digit month), DD and D. All date format in upper case. Time format as hh, h, mm, m, s, ss (lower case). Eg: YYYY/MM/DD hh:mm:ss returns 2010/03/30 13:22:00
CaptchaSimple arithmetic captcha. Refer to the sample below.
Mandatory fieldUser must fill in this field - or error warning will be given after submit. All mandatory fields start with a tilt “~”. Set the _formCleanFieldName to checked if you would like the field name to be shown without the “~” in the email

Captcha Support

In order to load and display captcha, you are required to insert the following javascript function into your html header.

<script language="javascript">
   $(document).ready(function(){
      $('#hv').load('/cgi-bin/vo/form_hv.cgi.vo');
   });
</script>

To display the captcha field, simply insert into your form.

Your Name: <input type="name" id="name" name="name" required>
Your Email: <input type="email" id="email" name="email" required>
<span id="hv"></span>
<input type="submit" value="Send Message">

Captcha Validation (Optional)

The following javascript function is used to check if captcha is filled when the form is submitted. If the captcha is not filled, the user will be alerted.

<script>
   function validateForm()
   {
      var x=document.forms["formName"]["_hv"].value;
      if (x==null || x=="")
      {
         alert("Please fill in captcha");
         return false;
      }
   }
</script>

Where formName represents the name of the form.

This function can be inserted as the onsubmit event of the form, like the example below.

<FORM action="http://vo.yourdomain.com/cgi-bin/vo/formmail.cgi.vo" method="post" id="formName" name="formName" onsubmit="return validateForm() />

Samples

dev/webmaster/form_mail_template_captcha.txt · Last modified: 2022/04/04 15:05 by vikki