Online Chat
 Call Us: 
1-877-744-1221
Browse Submit a Ticket
 
Advanced Search
Tools
Rss Categories

Upgrading My Existing Form from FPP v4 to FPP v5

Author: Eileen Wilde Reference Number: AA-00146 Views: 25000 Last Updated: 02/16/2010 08:09 AM 39 Rating/ 7 Voters

Upgrading My Existing Form from FPP v4 to FPP v5

  1. Introduction
  2. Initial Configuration Script
  3. Editing Pages
  4. Editing Templates
  5. Editing config.php

Introduction

Here, we'll guide you through the process of upgrading your existing form from Form Processor Pro v4 to Form Processor Pro v5.

To upgrade any form with Form Processor Pro, you only need to do four easy things:

  1. Point your form to FPP and give your form a name. You should point the ACTION attribute of your form to the fpp directory and give your form a unique name by inserting a HIDDEN field in the form's HTML just after FORM tag.
  2. Handle with error messages. Put the <!-- FPP_ERROR --> tag in your form's page in the where you'd like to display error messages.
  3. Create the required Email, HTML and/or Log templates. Use {# and #} brackets and hash signs to include any variable (field content) in the template. If you have a text field with name=email then you can use this variable in any template by putting it in brackets like this: {#email#}. This will be changed to the submitter's entered value after processing.
  4. Edit simple config file with required configurations. Set actions to perform, validation rules etc. All available actions, validations and modifiers can be found in this manual.

In this example we have a domain: mydomain.com and Form Processor Pro installed in the “fpp” public folder under the www root. In other words, Form Processor Pro can be accessed through: http://www.mydomain.com/fpp/index.php

Initial Configuration Script

Run the Initial Configuration Script and follow the instructions in order to perform initial Form Processor Pro configuration. The Initial Configuration Script (index.php) is located in the fpp/install folder. 

E.g.: If you've uploaded the fpp folder to www root folder of your www.yourdomain.com  server, you can access the Initial Configuration Script via www.yourdomain.com/fpp/install/index.php URL.

Editing Pages

You need to add the <base href...> tag directly after the <head> tag in your form page.

This line will prevent trouble with images, css, and urls that may appear after page processing.

If your page has the URL "http://yoursite.com/path/page.html", you need to add to the page:

<base href="http://yoursite.com/path/" />

Second, you need to change <form action> path to lead to the index.php file of Form Processor Pro v5, instead of the previous <form action...>. The form code should look like this:

<form name="Simple" method="post" action="../fpp/index.php" enctype="multipart/form-data">

where ../fpp/index.php is the relative path from form the page to Form Processor Pro. It can also be an absolute path like this:

<form name="Simple" method="post" action="http://yourdomain.com/fpp/index.php" enctype="multipart/form-data">

Put the <!-- FPP_ERROR --> into your page, to show any error resulting incorrect input, you may insert it anywhere you want the user to see the error on your form page.

If you have more than one form page, you need to repeat these actions for every page.

Then you need to name your form, as all configurations are stored in one configuration file, Form Processor Pro needs to differentiate one from another, therefore for this you need to add this line just after form tag <form action...>:

<input type="hidden" name="fpp_form" value="form_name">

where 'form_name' will be name of your form. This line only needs to be added to the first page of your form.

If you used CAPTCHA in you forms, there should be lines like this in your form:

<img src="../formprocessorpro.php?captcha">
<input type="text" name="r_captcha" value="">

You should change the first line  ("<img src...>) to:

<img src="../fpp/captcha.img.php">

where ../fpp/captcha.img.php is the path from this web page to the captcha.img.php file in your fpp folder

The input field can remain unchanged, but write down the name of the input field where you want to check the CAPTCHA code, as you will later use it in the configuration file.

Editing Templates

In Form Processor Pro v5, you need to use delimiters {# and #} instead of [ and ], so you need to open your templates in any plain text editor and change all the '[' bracket(s) to the '{#' and the ']' bracket(s) to the '#}' . So, if your email template looked something like this:

Previous email template:

To: "[firstname]" <[email]>
From: "My Company" <info@mydomain.com>
Subject: Thank you

Dear [firstname],
Here is information that you had filled in our form:
Name: [name]
Company Name: [company-name]
Contact Email: [email]

It must be changed to this:

To: "{#firstname#}" <{#email#}>
From: "My Company" <info@mydomain.com>
Subject: Thank you

Dear {#firstname#},
Here is information that you had filled in our form:
Name: {#name#}
Company Name: {#company-name#}
Contact Email: {#email#}

Editing config.php

Now in order to correct your final configurations we have to teach FPP how we would like our form to be processed. To do so, we have to edit config.php located in the fpp directory.

Tip:
In order to protect your email template files from undesirable browsing through HTTP, we suggest you place them in a separate folder and protect the folder from browsing. You can use the .htaccess file for this purpose on any Unix/Linux compatible host. Just add/create this file(.htaccess) in the folder with the email templates with the following content (you can also copy .htaccess file from the “tmp” or “attachments” folders of the fpp folders ):
<Files *>
Order allow, deny
Deny from all
</Files>

You will protect yourself from email harvesting bots by doing this.
On Windows based hosts, you can do this by setting corresponding permissions for the folder.

You need to open config.php file located in the fpp folder in any plain text editor, and add this line to the end of the file:

[form_name]

Where "form_name" is the name you gave the form in the FORM section of your web page HTML code.

This code designates where the form description starts. You can use the information from form.cfg file, but it needs to be modified. All lines that begin with '_error_path=' should be deleted, as errors now show on the form where the incorrect values are input.

The first line under form name should be:

page = ../path/formpage.html

Where formpage.html is the first page of your form, the path can be relative from config.php file to the page, it can be the absolute path, or you can use the URL of the page:

page = http://yourdomain.com/path/formpage.html
Note:
You have full control over any server-side script execution on form pages. If you use a relative or absolute path to file (e.g.: "../form/file.html" or "/fpp/form/filename.php") Form Processor Pro will process it as a text file. No scripts (e.g.: PHP, ASP) will be executed on the page. However if you use the full URL (e.g.: "http://www.yoursite.com/path/file.html") Form Processor Pro will let the webserver execute all server-side scripts on the page, and then will parse the form. The PHP option "allow_url_fopen" must be enabled to allow this behavior.

Paste you code from form.cfg file into the config.php file under the form declaration line.  You will now have lines like this:

_browser_out=preview.html
_send_email1=email.txt
_send_email2=email-autorespond.txt
_out_file=log.txt
_browser_out1=thank-you.html

You need to change '_browser_out=', '_browser_out1=' and so on to 'page = ' without any numbers.

page = http://yourdomain.com/preview.html
page = http://yourdomain.com/thank-you.html

All '_send_email#=' should be changed to 'email = ' also '_out_file=' should be changed to 'log_file = '

email = ../path/email.txt
email = ../path/email-autorespond.txt
log_file = ../path/log.txt
Note:
All paths must be relative from to config.php, absolute paths, or URLs to the needed files.

For more information about actions refer to the Actions chapter.

All validators now should be written into the config.php file in form description. Here are most popular and most useful validators:

To require a field to be filled:

required_fields = fieldname (Field Name), field2 (Second Field Name)

Please note that phrases in ( and ) brackets are only used in error messages, not of internal field names in the HTML. Thus,     your error messages can be intuitive, user-friendly, and you can even use languages other than English! You can write the validation rules as one field per line or all in one string and separate field names by commas.

Thus:

required_fields = name (Full Name), email (Contact Email), subject (Subject)

or

required_fields = name (Full Name)
required_fields = email (Contact Email)
required_fields = subject (Subject)

These two examples will have the same effect - required form fields: name, email and subject.

In order to require only properly formatted emails in the email field we will use the “email_fields” validation rule, like we did above:

email_fields = email (Email Address)

To activate CAPTCHA in your form, add this line

captcha_field = r_captcha (Value from CAPTCHA)

where 'r_captcha' is the name of the field, where submitter should input the value from CAPTCHA

For more information about validation rules refer to the Field Validations chapter.

Sample content for the config.php file
<?php header('Location: index.php'); ?>
/* GLOBAL FPP SETTINGS - BEGIN. THESE SETTINGS ARE APPLIED TO ALL FORMS! */
smtp_server = localhost
smtp_port = 25
date_format = H:m d/m/y
/* GLOBAL FPP SETTINGS - END */
/* FORMs' configurations. [form_name] - Declares form name and its settings below. */
[some_form]
page = http://yourdomain.com/preview.html
page = http://yourdomain.com/thank-you.html
required_fields = fieldname (Field Name), field2 (Second Field Name)
email_fields = email (Email Address)
captcha_field = r_captcha (Value from CAPTCHA)

That's all! We have finished upgrading your existing form from FPP v4 to FPP v5!