User Tools

Site Tools


phplugins_customize_the_contact_form

Customize the Contact Form

In this tutorial, we will use the PHPlugins ttg_contactform hook to customize our contact forms.

This hook is available only in the following engines:

  • TTG CE3 Client Response Gallery 5.0.0
  • TTG CE3 Pages 6.0.1

One may wish to customize the contact form to include additional input fields, or to implement email verification, captcha anti-spam measures, etc. after upgrading to Form-to-Email Pro.

We assume you have already enabled PHPlugins for your site or galleries.

As a base, use the following function and make any necessary edits:

// CUSTOM CONTACT FORM
function ttg_contactform( $style, $path ) { 
	echo '

	<p>
	<label for="field1"><%= model.metadata.contact_form_label.name %></label>
	<input id="field1" name="name" type="text" size="30" tabindex="1" required />
	</p>

	<p>
	<label for="field2"><%= model.metadata.contact_form_label.email %></label>
	<input id="field2" name="email" type="text" size="30" tabindex="2" required />
	</p>

	<p>
	<label for="message"><%= model.metadata.contact_form_label.message %></label>
	<textarea id="message" name="message" rows="7" cols="30" tabindex="3"></textarea>
	</p>

	';
	return false;
} // END

Note that the 'name' and 'email' fields are REQUIRED in order for the Form-to-Email script to function and should not be removed for any reason.

When inserting new fields, you should change the 'tabindex' values so that they remain sequential.

As much as possible, added fields should mimic the syntax of those fields provided above.

phplugins_customize_the_contact_form.txt · Last modified: 2014/11/11 01:39 by admin