E-mailing from forms
In this section, we will discuss how to create HTML forms in MODx that can send mail to the moderator of the site. Such forms are often used as enquiry forms or feedback forms. When a user enters some information, the moderator receives an e-mail with the details. In MODx, you can achieve this by using the eForm
snippet. eForm
can also validate the form before sending out the e-mail. The eForm
snippet comes bundled with MODx and hence you don't have to install it.
To start using eForm
, let us create a resource with the following details.
Field Name |
Field Value |
---|---|
Title |
Enquiry Form |
Uses template |
Learning MODx default template |
Document content |
[!eForm? &formid=`EnquiryForm` &subject=`[+subject+]` &to=`youremailid` &tpl=`EnquiryForm` &gotoid=`1` !] |
Now, create a chunk with the name EnquiryForm
, and with the following content.
<p class="error">[+validationmessage+]</p> <form id="EnquiryForm" method="post" action="[~[*id*]~]" > <...