Visual Form Builder Pro 1.5 released

Visual Form Builder Pro 1.5 is now available for download.  This version includes a ton of advanced features, which I will get to shortly, but there’s one very big addition included: the SPAM verification section is now optional.

Disable the SPAM verification by going to the Form Settings

Removing the automatic SPAM verification is perhaps the most asked for feature request I get.  The message was clear.  You wanted this.  And I want Visual Form Builder to be a product that serves your needs.  Your forms will still be protected using the other security measures built into the plugin, but there is always a risk so please keep an eye on how your forms are being used.

Version 1.5 includes more than just being able to turn off the SPAM verification!  I have added a ton of hooks and filters throughout the code to allow for some advanced modifications and controls.  Also, there are new custom capabilities to allow for even more control over who can see what.  I will have more posts talking about the filters in the future, so keep an eye out for those.

Release Notes

  • Add ability to turn off the spam Verification section
  • Add custom capabilities for user roles
  • Add various filters
  • Add nag message if free version of Visual Form Builder is detected and still active
  • Fix bug in Analytics and Email Design where the initial form might not display
  • Fix bug where certain rows in the email would not use the alt row color
  • Fix bug for plain text email formatting
  • Fix bug where notification email would send as HTML even if plain text was selected
  • Update subnav to accommodate new custom capabilities
  • Update list of spam bots
  • Update spam bot check to only execute when form is submitted

Adding custom jQuery validation to your form

In most cases, the standard validation options that ship with Visual Form Builder will cover most of your needs.  However, there are those occasions where you need something customized and the standard options just don’t cut it.  Today, we’re going to look at how you can add your own jQuery validation rules.

Before we begin, you might want to head over to the jQuery Form Validation plugin pageand read through some of the documentation to get a better idea of what we’ll be talking about.

Create a JS file and add to your theme via functions.php file

Go into your theme’s folder and create a new file called vfb-js.js in a folder called js.  Create that folder if it doesn’t exist.

Now, go to your theme’s functions.php file and add the following code:

function my_scripts_method() {
   wp_register_script( 'vfb-js-file',
       get_template_directory_uri() . '/js/vfb-js.js',
       array( 'jquery' ),
       '1.0',
       false );

   wp_enqueue_script( 'vfb-js-file' );
}

add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

You are now ready to configure your JavaScript file.

Prepping our validation class

All custom rules that you want applied to a form will need to be placed inside the validation class.  But first you will need to find the ID of the form you want to configure.  Here, I am using Firebug to find that out, but View Source works just as well.

Getting the form ID using Firebug

Open your vfb-js.js file and add the following code:

jQuery(document).ready(function($) {
    $('#contact-us').validate({
        rules: {

        }
    });
});

Example #1: Require multiple checkboxes to be selected

For this example, let’s say that we have a form with a Checkbox field called Topics of Interest with several different topics to choose from.  This is a required field, but we also want to make sure they select at least two topics.

In the same way that we grabbed the ID of the form, we’ll need to do the same here to get the name property of the checkbox field.

Getting the name property of the checkbox field using Firebug

Open your vfb-js.js file and add the following code:

jQuery(document).ready(function($) {
    $('#contact-us').validate({
        rules:{
            'vfb-topics-of-interest-26[]':{
                required: true,
                minlength: 2
            }
        }
    });
});

But that’s not all. We can also customize the error messages for that field!

jQuery(document).ready(function($) {
    $('#contact-us').validate({
        rules:{
            'vfb-topics-of-interest-26[]':{
                required: true,
                minlength: 2
            }
        },
        messages:{
            'vfb-topics-of-interest-26[]':{
                minlength: 'Please select at least two topics.'
            }
        }
    });
});

Example #2: Require one field to be equal to another field

In this example, we have a Test Answer field but we need to be able to confirm that the user has entered the data correctly.  To do this, we’ll add a second Text field and call it Confirm Test Answer.  Now, we just need to make our first text field equal to our second one in our jQuery and throw an error message that lets them know if they don’t match.

Requiring one field to be equal to another

jQuery(document).ready(function($) {
    $('#contact-us').validate({
        rules:{
            'vfb-topics-of-interest-26[]':{
                required: true,
                minlength: 2
            },
            'vfb-confirm-test-answer-621':{
                equalTo: '#vfb-test-answer-620'
            }
        },
        messages:{
            'vfb-topics-of-interest-26[]':{
                minlength: 'Please select at least two topics.'
            },
            'vfb-confirm-test-answer-621':{
                equalTo: 'Your answers do not match'
            }
        }
    });
});

Example #3: Make a field required, depending on the value of another field

Let’s say that you have a form where you have a Start Date and an End Date.  If the user fills out the Start Date, the End Date needs to be required.  The End Date, in this case, is dependent on the Start Date not being left empty.

jQuery(document).ready(function($) {
    $('#contact-us').validate({
        rules:{
            'vfb-topics-of-interest-26':{
                required: true,
                minlength: 2
            },
            'vfb-confirm-test-answer-621':{
                equalTo: '#vfb-test-answer-620'
            },
            'vfb-end-date-85':{
                required: function(e){
                    return $('#vfb-start-date-80').val() !== '';
                }
            }
        },
        messages:{
            'vfb-topics-of-interest-26':{
                minlength: 'Please select at least two topics.'
            },
            'vfb-confirm-test-answer-621':{
                equalTo: 'Your answers do not match.'
            }
        }
    });
});

You can customize this to your needs so if you need the Start Date to have a certain value before the End Date is required, you can do that too.

As you can see, there are plenty of ways to extend your form with jQuery to accomplish some custom and complex things.

Visual Form Builder Pro 1.4.1 released

Visual Form Builder Pro 1.4.1 is now available for download.  This release fixes the problem from version 1.4 where exporting entries stopped working, as well as server-side validation on certain data types.

Also, I decided to include a small bonus to this update that includes a Dates filter on the Entries screen.

Release Notes

  • Fix bug where Export entries feature was broken
  • Fix bug where server-side validation failed on certain data types
  • Add months drop down filter to Entries list

Visual Form Builder Pro 1.4 released

Visual Form Builder Pro 1.4 is now available.  This version brings several new additions as well as a ton of improvements.  Most notably is the ability to set a Default Value for most fields.  You are also now able to set a default country in the Address field.  The Entries screen has also seen several new features (search!) as well as performance enhancements.

I’m also excited to announce the new media button that makes inserting forms into your Posts/Pages even easier.  Located next to the Upload/Insert button above the Visual Editor is a new button for Visual Form Builder forms. Simply select the form you want to use and it’ll insert the shortcode for you.

Release Notes

  • Add media button to Posts/Pages to easily embed forms
  • Add search feature to Entries
  • Add Notes field to Entries detail
  • Add Default Value option to fields
  • Add Default Country option to Address block
  • Fix bug where Plain Text emails would not send
  • Fix bug where Required option was not being set on File Upload fields
  • Fix bug where Form Name was not required on Add New page
  • Update plugin menus to be added the “right” way
  • Update and optimize Entries query
  • Update menu icon to custom form icon (thanks to Paul Armstrong Designs!)
  • Update Security Check messages to be more verbose
  • Update email formatting to add line breaks
  • Update how the entries files are included to eliminate PHP notices
  • Update output to warn users of a missing fieldset if not at the beginning
  • Minor updates to CSS

How to configure the email details in Visual Form Builder

One of the more common support questions I see for Visual Form Builder is how the Reply To Name and Email fields work.  This is probably because if you are not familiar with the process of sending an email through a server, it can seem a little obtuse.

When you make an email in a program such as Gmail or Outlook, that program controls the sending details.  It knows your display name (usually your first and last name), your email address, subject line, and all other things that go along with an email.

However, when sending an email without one of these programs we have to tell the server what each of those are.

Email configuration details

As you can see in the image above, all emails have these details in common.  You can email to one or more people, set a subject, plus the name and email of who it’s from.  Let’s go over how to do this in Visual Form Builder.

Go to your form and click on the Form Settings button. Click on Email to reveal the email details settings.

Email details settings screen

So, we can see that the same kinds of details can be customized to control what your email looks like when received in the email client.

  • E-mail Subject = Subject Line (painfully obvious, I know)
  • Your Name or Company = From Name
  • Reply-To E-mail = From E-mail
  • E-mail(s) To = To

That’s great, you say, but what about if you want to have the user’s name and email already set in the email?  This is great for when you want to reply directly to the user via email.  This is where the User’s Name (optional) and User’s E-mail (optional) fields come into play.

  • User’s Name – requires your form to have a Text field and the Required option set to Yes.
  • User’s E-mail – requires your form to have an Email field and the Required option set to Yes.

NOTE: If you have not fulfilled those requirements, the drop downs will not be populated with choices.

In the end, all we’re really doing is sending an email and we have to configure the program (in this case, the server) with all of our email details.  If you have any questions, please leave a comment!

 

Take control of your form’s look with the new Field Layout option

In Visual Form Builder, you can now customize the layout for the fields in your form by using the Field Layout option.  This is an easy way to tweak and control the look and feel of your form without having to write a bunch of new CSS.  Today, I’m going to go over how to use this powerful new feature.

Where is the Field Layout option?

All fields except for Fieldsets, Sections, and Instructions will include a Field Layout dropdown, seen below.

Field Layout option

Default Layout – Single Column

By default, all fields will be arranged in a single column.  If you have a particularly long form, or just want to change up the look to make your style, this may not be an ideal layout.

Default field layout

Left/Right Half – Two Column

To achieve a two column look, we will need to assign the Field Layout options as either Left Half or Right Half, depending on where you want that field to go.  On my example form, I change the Name item’s Field Layout to be Left Half and the Email item’s (which is arranged directly beneath Name) Field Layout to be Right Half.

It’s important that the two fields are next to each other in the form builder in order to achieve the correct look.

Left/Right Half field layout

Left/Middle/Right Third – Three Column

We can arrange even more fields on a single line using the Left, Middle, and Right Third option.  On my example form, I have three fields I want placed in one line: Start Date, End Date, and Number.  Start Date will be Left Third, End Date will be Middle Third, and Number will be Right Third.

It’s important that the three fields are next to each other in the form builder in order to achieve the correct look.

Left/Middle/Right Third field layout

Left/Right Two Thirds – Mixed columns

The last option allows us to stretch one field across two thirds of the form.  This is useful when you have one field that needs to be longer than the other on the same line.  The way we achieve this is by combining a Left/Right Two Third with a Left/Right Third.  On my example form, I will assign the URL as Left Two Third and Phone as Right Third.

It’s important that the two fields are next to each other in the form builder in order to achieve the correct look.

Left/Right Two Thirds field layout

If you wish to have the larger field on the right, simply use a Left Third with a Right Two Third.

Final Result

As you can see, our final result is a much smaller footprint for this form.

Customized fields using the Field Layout option

If you have any questions, please let me know!

How to change the layout of Radio buttons and Checkboxes

In the latest version of Visual Form Builder, you are now able to take control of how radio buttons and checkboxes are arranged.  Previously, you had no control (other than directly modifying the CSS) of the layout and it was a simple vertical list.

If you have a lot of options, this single vertical column can get pretty long.  Even if you don’t have a lot of options, perhaps you want to save a bit of space.  Whatever your reasons, being able to play around with the look and feel of your form is important.  So, in light of that, let’s see how you can customize the layout.

The Options Layout dropdown in the admin

It’s easy to change the look: go to your Radio or Checkbox field and you’ll see the Options Layout dropdown.  Choose from the different options to achieve the look you desire.  By default, all Radio and Checkbox fields are arranged in a One Column layout.

Options Layout

  • One Column: a single, vertical list
  • Two Columns: creates two equal columns
  • Three Columns: creates three equal columns
  • Auto Width: uses the width of the options to control the width

With only a few minutes, you can totally change the look of your form without ever having to touch the CSS.

Control what file types you accept with the File Upload field

The File Upload field was recently expanded in Version 1.2 of Visual Form Builder to allow control over the file types accepted.  Up until now, it has accepted all files, but you may not want that behavior for a public form.

If you are building a contact form to accept job applications, you might want the user to only upload a PDF, DOC, or TXT.  Using the Accepted File Extensions option, here’s what you need to enter:

pdf|doc|txt

Note the pipe character ( | ) in between each file extension.  If you are not a fan of the pipe character you can substitute it with a comma ( , ).

As of Version 1.2, if you leave this option blank, the default validation for File Uploads will be to only accept images (png, jpeg, gif).

That’s it!  A super simple and quick way to restrict the types of files uploaded with your form.

How to customize the Date Picker

Getting a properly formatted date from a user can be a pain.  Did they type with dashes, slashes, spaces, commas, or a combination of everything?

This is where a Date Picker comes in handy.  A Date Picker is a JavaScript tool that pops up a little calendar that lets a user click the date they want and it will format the date in the way you desire.  In Visual Form Builder’s case, the Date Picker is built using the jQuery UI Date Picker.

Default Date Picker Configuration

This Date Picker is a highly complex and customizable jQuery plugin.  So, in order to meet the needs of the many, Visual Form Builder uses the default configuration.  Today, I’m going to explain how to customize the calendar to work like you want it to.

Before we begin, you need to decide what you want to do:

  1. Change the configuration for all Date Pickers on all forms
  2. Change the configuration for each Date Picker on each form (if desired)

In either case, you’ll need to create a JavaScript file and properly add it to your theme via the functions.php file.

Create a JS file and add to your theme via functions.php file

Go into your theme’s folder and create a new file called my-js.js in a folder called js.  Create that folder if it doesn’t exist.

Now, go to your theme’s functions.php file and add the following code:

function my_scripts_method() {
   wp_register_script( 'my-js-file',
       get_template_directory_uri() . '/js/my-js.js',
       array( 'jquery' ),
       '1.0',
       false );

   wp_enqueue_script( 'my-js-file' );
}

add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

You are now ready to configure your JavaScript file.

Configure All Date Pickers on All Forms

This option will change all Date Pickers on any form you happen to create.  This is handy if you like the default configuration but perhaps need to change a few things about it.  For a full list of Date Picker configuration options, please see the documentation.

Open your my-js.js file and add the following code:

jQuery(document).ready(function($) {
    $.datepicker.setDefaults({
        dateFormat: 'yy-mm-dd'
    });
});

Configured Date Picker with global defaults

Configure a Single Date Picker on a Single Form

This option will change a single Date Picker on a single form.  This is useful is you have multiple Date Pickers on a single form and require different configurations for each.

First, you will need to use your browser to View Source.  Find the ID on the Date Picker you want to configure.  Here, I am using Firebug to find that out, but View Source works just as well.

Using Firebug to get the ID

Open your my-js.js file and add the following code:

jQuery(document).ready(function($) {
    $( '#vfb-date-318' ).datepicker({
        numberOfMonths: 2
    });
});

Configured Date Picker for a single field

Bonus: Use Both Configuration Methods

You can use the two methods above to your advantage by combining each technique.  This can be used when you need to set defaults for all Date Pickers yet still be able to configure a single Date Picker on a form.

jQuery(document).ready(function($) {
    $.datepicker.setDefaults({
        minDate: -20,
        dateFormat: 'yy-mm-dd'
    });

    $( '#vfb-date-318' ).datepicker({
        numberOfMonths: 2
    });
});

Configured Date Picker using global defaults with a single field

As you can see, the Date Picker can be complex but it’s also really powerful.

How to use the Page Break field in Visual Form Builder Pro

One of the cool new features in Visual Form Builder Pro is the Page Break.

Long forms are better broken up into smaller chunks so as not to overwhelm the user.  You see this technique more often in online surveys or shopping carts.  One disadvantage to the traditional form page break is that you are usually shuffled off to a completely different page, forcing the user to page back if he forgets something on the previous screen.

Visual Form Builder Pro fixes this by using jQuery to hide the next “page” and reveal each section only when the user is ready.  Because it is such a new concept, I’m going to show you how to use it.

First, go to the form builder and click on the Advanced tab and then click on the Page Break item to add it to your form.

Treat Fieldsets as your logical break

The Page Break navigation is added to the end of fieldsets, so treat these as logical breaks in your form.

A Page Break should be placed at the end of a fieldset group but immediately before the next fieldset.

A Page Break inserted in between two fieldsets

You may change the name of the Page Break navigation to whatever you like.  Once you save the form, visit your form and this is what you should see:

A form with a rendered Page Break

As you can see, the Next button has been added along with a counter of which page your are on and the total pages of this form.  Clicking on the Next button nicely fades in the next page while fading out the Next button that was just clicked on.

There is no limit to the number of fieldset groups under a page

Once you have added a Page Break to a form, you are not limited to the number of fieldset groups that follow it.  So, in my example I only have a single fieldset before adding a Page Break.  The next page holds two more fieldsets and the verification, which is the end of the form.  If I wanted to, I could add another Page Break in between one of those fieldsets and I’d have three pages instead of two.

By using a Page Break, those long forms won’t look so intimidating, mistakes will be limited, and all input is validated on the same page to increase conversions.

That’s it!  Simple, right?