All for creating and promoting websites

Layout, programming, web tools

The form of feedback on the MODX Revolution without spam

The form of feedback on the MODX Revolution without spam

To create a form on Modx without spam, you need to create it with additional invisible fields:

1. Download and install the Ajaxform and Formit components.

2. The form is called very simply, you have to understand

	&validationErrorMessage=`The form contains errors!`
	&successMessage=`Thank you for your application! We will contact you shortly.`

Description of the parameters:

  • snippet - Snippet for processing AjaxForm, put Formit - it just sends letters
  • form - Chunk of the form design, there is one that is by default
  • hooks - Hooks to protect against spam and send emails
  • emailFrom - Address from which the letter comes
  • emailTo - Address to which the letter comes
  • validate - Validation, there are also two invisible fields
  • validationErrorMessage - Message that will be displayed, if fields are not successfully entered
  • successMessage - Message that will be displayed if the message was sent successfully
  • emailTpl - Chunk, which stores the template of the incoming letter to the post (read about it below)

3. After this, go to our shape design chunk, in this case it's tpl.AjaxForm.example and add after the form tag, the following two fields.

<form action="" method="post" class="ajax_form af_example form-horizontal">
 <input  class="forminpun" type="hidden" name="nospam:blank" value="" />
 <input class="forminpun" type="hidden" name="work-email" value="" />

Now your form should not be spammed, due to two new fields.

4. Appearance of the incoming email

By default, a letter comes to the mail without any formatting in a not very readable format. So let's take a look at our letter for an example.

The message template is a simple chunk, which we specify in the emailTpl parameter, everything is very simple, I will write an example of the design. If you have any questions, please write in the comments.



На сайте [[++site_url]] оставили заявку.


Name: [[+name]]

`]] [[+email:notempty=`

Email: [[+email]]

`]] [[+message:notempty=`

Message: [[+message]]


Please contact him shortly.

Do not reply to this email because it's automatic..

Highlight found mistake and press Ctrl + Enter to notify the administrator.