FormCraft for PHP

by nCrafts

nCrafts.net

Installation

  1. Extract the download package and edit the file config.fc.php.
    1. The default username and password is set to demo, and demo. You can change this here.
    2. The database name, by default, is formcraft_123. Change this name to any other long string. Think of this as a password. Example: aoidhjaoisdhaosicnaoicb. Don't worry - you don't have to remember this.
    3. Now, you need to set the $path to the location of the FormCraft directory on your site.
  2. Set the permissions of the directory formcraft/ and formcraft/file-upload/server/php/files/ to 755
  3. Upload the formcraft directory to your website, say http://example.com/formcraft. Then visit this URL: http://example.com/formcraft

Form Building

To access the form builder, click on a form under Forms. The form builder screen can be divided into two parts. The left part is the Dashboard and the right part is our Form Preview.

Dashboard

  1. List of Forms: Takes you back to the form index.
  2. Save: The form saves every 30 seconds. Nevertheless, you can click on Save to manually save it any time.
  3. Form Options
  4. Styling: This allows you to customize the various elements of the form.

Below these options are the various form elements you can add. To add a form element, just click on the button.

File Upload and Captcha fields cannot be added more than once in a form.

You can embed Google Maps using the Custom field. Get the HTML link from Google Maps, and paste it in the text box in the options for Custom field.

Follow the same procedure to embed videos, and other widgets.

Form Preview

To view the options of the Form Title, Submit Button, or any added element, click on it.

You can drag and drop the elements to change their order.

The Live Form Preview tries to capture the form just as would appear on your page. However, the actual form might appear different depending on your theme, and other changes to basic CSS styles.

Using the Forms

Place these two line on your page where you want the form to appear

<?php 
require_once('../function.php');
formcraft(1); 
?>

The first line should point to the function.php file which is inside the formcraft directory.

The second line tells the script which form to use here. You can alter this line to use different types of forms - fly in, sticky, popup, or inline form. See below for details:

formcraft($id, $type, $opened, $text, $class, $background, $text_color);
  1. id This attribute is compulsory.

  2. type
    If you want the form to open in a popup box, set this to popup.
    If you want the form to open in a sliding tab, which rests in the bottom right corner of the page, set this as sticky.
    If you want the form to open in a popup box, with the trigger button resting on the right side of the page, set this as fly.
    Else, leave this attribute.

  3. opened If set as 1, the form will open / slide up, as soon as the page is loaded.
    Works only if type is sticky or fly

  4. text Text which will trigger the popup box on click.

  5. class If you wish to give custom style to this text, you can set a class here. If you are not sure, leave this attribute.
    Works only if type is popup

  6. background Set the background color of the trigger button. You can use values like red, white, blue etc... You can also use values like #333, #DD1, #45A etc...
    Works only if type is sticky or fly

  7. text_color Set the text color of the trigger button. You can use values like red, white, blue etc... You can also use values like #333, #DD1, #45A etc...
    Works only if type is sticky or fly

Examples
							
formcraft(20); // Use the inline / regular form
formcraft(20, 'popup'); // Form opens on click, in a popup box
formcraft(20, 'popup', 'Contact Us'); // Text of popup box is 'Contact Us'
formcraft(20, 'sticky', '', 'Contact Us'); // There is a button on the bottom right corner of the page which will slide up the form on click
formcraft(20, 'fly', 1, 'Contact Us', '', 'red', 'white' ); // There a red button on the right side of the page which will trigger the form on click. Also, the form would open on it's own when the page loads.

Understanding Conditional Laws

Basics

You can use conditional laws to show / hide elements dynamically based on their value. However, conditional laws are not available for the following field types:

  1. Choice Matrix
  2. Sliders
  3. Range
  4. Dividers
  5. Hidden Field
  6. Captcha
  7. Custom

How Show / Hide Works:

  1. Show
    If a certain value is selected / entered in the input field, a specific element is shown. It is recommended that the element which is to be shown should be Hidden by Default, from the options of the respective element.

    Example: I have a field #3 which is to be shown when the value of the input field #1 is set to test. If the value test is typed in this field, the field #3 will be shown, but when I type in any value other than test, the field #3 will hide (whether or not it was Hidden by Default)

  2. Hide
    If a certain value is selected / entered in the input field, a specific element is hidden.

    Example: I have a field #3 which is to be hidden when the value of the input field #1 is set to test. If the value test is typed in this field, the field #3 will hide, but when I type in any value other than test, the field #3 will be shown (whether or not it was Hidden by Default)

Specifics

  1. Fields: Star, Smiley, and Thumb
    Each selectable option of the fields Star and Smiley has a pre-defined value, from 1 to 5 (in case of Smileys) and 1 to 5 (or more, in case of Stars). If, say, you want to show field #3 when the lowest smiley rating is selected by the user, you will set the conditional law to

    if this element equals 1 
    then show
    element 3
    Thumb fields have two predefined values: 1 for the positive rating (thumb up) and 0 for the negative rating (thumb down)

  2. Fields: CheckBox, MultiChoice, and DropDown
    Unlike star, smiley and thumb ratings, the value of each option is customizable here, and the show / hide event is triggered when a specific option is checked. In case of checkboxes, where multiple options can be selected, the show / hide event will be triggered if a specific option is checked, whether or not other options are also checked.

  3. Fields: Email, One Line Text, DateInput, and MultiLine
    The plugin also allows you to set conditional laws to text fields, and the show / hide events work live.

    Example: I have a field #3 which is to be hidden when the value of the One Line Input Field #1 is set to test. As soon as the value test is typed in this field, the field #3 will hide, but when I type in any value other than test, the field #3 will be shown (whether or not it was Hidden by Default)

    Isn't it awesome?

  4. Fields: File
    The value of the File field will be the number of files uploaded

Form Submissions

When a user submits a form, the form data is delivered to the email recipients, and is saved in a database.

Email recipients can be added under Form Options inside the Form Builder screen.

All the form submissions can also be accessed from the Submissions table in the Form Index screen.

On the same screen you can see statistics on form submissions.

You can also export the form submissions data to a spreadsheet by clicking on Export Data to CSV.

File Manager

As you might know, FormCraft has a fantastic File Upload field feature for your forms. All the files uploaded by users can be viewed from the File Manager table from the Form Index screen.

You can also access the uploaded files by viewing the form submissions data.

Support

In case of general queries or clarifications, you can post a comment in the Item Discussion section.

If you encounter bugs along the way, or wish to suggest some features in the plugin, please contact me through my profile page.

If you like the plugin, please give a rating :)