Wordpress: Easy to use and fairly customisable forms

cForms II is a pretty nice plugin for WordPress that allows you to create a custom form quite quickly and embed it into your post or page.

It has a fairly wide set of options (see information page) but does not support the high level of customisation which Drupal allows such as custom validation (as far as I can tell).

Creating a form

In order to embed a form, firstly you'll have to create one.

Go to the admin and you'll see a new menu group called "cForms II". Under that, click "Form settings". From here you can add or remove fields from the default form, change some messages and other options related to ONLY this form.

Note: It's a good idea to click "Update settings" after you're done modifying parts of the form as some changes (such as adding a new field) will refresh the page, causing you to lose other changes in the form.

image

Update settings can be found on the right side of the admin form under the expandable "Admin Actions" widget.

You can mess with the global settings too, but I'm not gonna cover that in this tutorial.

Inserting the form into a post or page

When you're happy with it, figure out where you want to use it. Forms can be embedded in the post, a page, or anywhere on the template.

If you're using the WYSIWYG editor for posts or pages, you can use the cForms button in the TinyMCE toolbar.

image
Clicking on this will grant you three wishes.

Select the form you want to insert.

image

And whalla! Form inserted into post/page.

Inserting form into template

Lastly you can insert the form directly into the template using some PHP code.

If you're adding it into the template somewhere, then use the following snippet.

insert_cform(check_form_name('your_form_name'));

I'm not sure why the first arg isn't the form name, but it took me a while to figure that one out.

Documentation

That should be enough to get you started with cForms. There are also information pages within the plugin administration panels to give you a fair idea of how things work.

[ Download ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog