WordPress Google Form v0.61-beta-1 available

About a week ago I was approached with an interesting problem.  A user wanted to have the same form on single page three times.  Three instances of the same form.  Each instance would have some hidden values to determine which form was submitted.

The problem was by putting the same exact form on the page multiple times, a lot of the content (id and name attributes) was duplicated and as such, caused problems upon submission or even trying to move from field to field on the form.  The current (v0.60) version of the plugin is effectively broken for multiple forms except in the simplest of cases (no CAPTCHA, validation, presets, etc.).

I’ve come up with a solution that needs some testing.  I’ve added a new short code attribute to the wpgform shortcode which takes a string value and uses it as a unique identifier to ensure the replicated fields are actually unique in the source HTML.

In the image below you can see the text “B-” has been prepended to the id attribute for the form tag and an input tag.  The “B-” was the value of the uid parameter in the shortcode for the form.

[wpgform id='879' uid='B-']

GForm_SS_69

Download this beta version and run it through its paces.  The ripple effect of this change across the code was pretty significant so I’d like to make sure it didn’t break anything.

Google Forms Beta (7992 downloads )

WordPress Google Form v0.59 released

After I have not had any reports of issues since releasing beta-3 so I have pushed out the formal release.  You can find v0.59 in the WordPress plugin repository or on your Dashboard.

Enhancements and Bug Fixes in v0.59:

  • Added ability to preset values for Google form as part of WordPress URL.
  • Added new CSS declarations to default plugin CSS to account for recent changes by Google to Forms.
  • Added ability to define fields as “hidden” and preset with a user defined or system defined value.
  • Fixed validation limitation which only allowed one validation rule per input.
  • Added basic support (CSS, jQuery) to use WordPress Google Form to view a Google Spreadsheet within WordPress.

wpGForm Unintended Functionality

For the past couple days I have been helping a user who was running into some problems with WordPress Google Form.  There are two threads on the WordPress Support Forum (here and here) where we went back and forth with me trying to understand his problem.  Eventually we moved to email so he could send me some screen shots as he wasn’t working on a live site.

As you can see from the support threads, I was rather confused as to what the user was trying to do.  It turns out, this user was using WordPress Google Form to display a Google Spreadsheet as opposed to a Google Form.  Once I understood what the user was doing the questions made a whole lot more sense.

The part which still didn’t make sense was why he was using WordPress Google Form to display the spreadsheet instead of a plugin dedicated for the task (e.g. Inline Google Spreadsheet Viewer).  I had never tried using my plugin to view a spreadsheet as it was never designed for that purpose.

As it turns out, for the most part it works.  If you publish a spreadsheet and use the URL when defining a Google Form, you will end up with something which looks like this:

GForm_SS_65

Surprisingly, it doesn’t look all that bad.  With a little bit of Custom CSS, it could actually look pretty good.  Here is some form specific Custom CSS I added to the form definition:

td.hd {
 display: none;
}
tr.rShim td {
 width: auto !important;
}
div div span.powered {
 display: none;
}
div.listview {
 display: none;
}

The result now looks pretty good.

GForm_SS_66

The header rows and and the table content are actually output by Google in separate tables.  It would be nice if they were in a single table – I am not sure of the logic behind having them as separate tables but that is what Google generates.

I am adding some new functionality to support this unusual usage of the plugin.  Because the Google “Powered By” block contains a link to the original spreadsheet, which often times is a undesirable, if the Legal option is turned off for the defined form, the “Powered By” block will be removed with jQuery.

I am also going to add some basic CSS (like above) to the default CSS to support this as well.  Look for a new beta release shortly.

WordPress Google Form v0.55 released

Yesterday WordPress 3.6 was released.  The bundled version of jQuery was updated to 1.10 which broke the jQuery Columnizer plugin I use to split a form into columns.  The result was jQuery would go into an infinite loop and eventually you would have to kill the page.

Fortunately someone had already encountered this problem and provided a patch to the jQuery plugin.  I have incorporated the patch and released v0.55.  If you’re running WordPress 3.6, this is a critical release.  Older versions should continue to run correctly.

You can find v0.55 on your WordPress Dashboard or in the plugin repository.

WordPress Google Form v0.54 released

This morning I released v0.54 of WordPress Google Form.  It has been a while since I’ve had any bug reports for the current version or the beta version.  Things appear pretty stable.

  • Added internationalization support for jQuery Validation messages.
  • New language support files.
  • New jQuery Validation based custom validation option.
  • Fixed problem with escaped characters ending up in Google spreadsheet.
  • Moved transport control out of debug module and into core code so it can be a permanent setting for some server environments.
  • Fixed PHP warning messages which happen with Logging Enabled when some of the server variables don’t exist.
  • Fixed bug with Form Submission Log setting stickiness.
  • Added an optional CAPTCHA message which will appear below the CAPTCHA input when set.

WordPress Google Form v0.54-beta-2 now available

I have just uploaded beta 2 of WordPress Google Form v0.54.  This update fixes the problem with the validation meta box not allowing adding additional fields (a jQuery script was not loading correctly) and also fixes the issue with range checks I mentioned in the beta 1 announcement.  At this point I believe everything is working correctly.

I have put together a Validation Demo Form that you can play with to see  how it works.  There are some images below from the demo form running in my development area including how I set up the validation information when creating the form.

Google Forms Beta (7992 downloads )

GForm_SS_52 GForm_SS_53 GForm_SS_54

Advanced Validation with WordPress Google Form

One of the most common requests I receive is the desire to validate fields on a Google Form. Google provides some basic validation (required or not) but there really isn’t a way to ensure that if you request an email address that the user actually provides a valid one. Similarly, there is a need for URLs, numbers, and other specific fields.

I’ve been using the jQuery Validate plugin (which looks to have a new  home) for a while now to validate required fields and in some cases, email addresses, and most recently, CAPTCHA support.

A number of people have asked me about extending the validation to include any field.  I have been reluctant to do this for several reasons:

  1. The jQuery Validate plugin needs to know which fields (by name or id) it is going to validate.  There isn’t an easy way to pull these out of the Google Form HTML.  It could be done on a single page form but because Google supports multi-page forms, they only way to find the information we need is to visit every page of the form.  This isn’t easy to do programatically.
  2. The rules needed to be written in jQuery syntax.  While the syntax isn’t difficult, if I allow entry of Javascript the potential for syntax errors (which would break the plugin) is very high.

For these reasons I’ve kept this on the back burner for a while.  However, a couple recent requests got me thinking about it again and it would be useful for a project I am doing for my daughter’s soccer team.  So I decided to dig into it.

I don’t think it is possible to make it completely foolproof however I did want to make it as simple as possible.  I decided to add a new Meta Box to the Custom Post Type editing screen which “helps” the user define new rules.

The key to making rules which accomplish something is getting the name attribute for the form entry element that needs to be validated.  There really isn’t a good way to do this other than to look at the HTML source.  I like FireBug with Firefox but both Chrome and IE have the ability to easily inspect an element.

GForm_SS_48Now that I know my input element’s name (entry.409811816) I can set up my new rule.

If you have been using WordPress Google Form the first thing  you’ll notice is the Form Editing screen has changed quite a bit.  The form was getting very long and cluttered so I have moved some of the lesser used options to a new Meta Box on the right hand side leaving just the critical or frequently used options on the primary Meta Box.

There is a new Meta Box just for Validation.  This Meta Box lets you add a series of fields where you can enter the name, the type of check to perform, and if needed, a check value.

GForm_SS_49Once the validation fields are set up, you can see the effect as you fill out a form.

GForm_SS_50 GForm_SS_51I am going to clean up a few things and make a beta release available for people to test with.  I think this functionality is pretty cool and it was a bit of a challenge to (a) get it working and (b) find what I think is a viable usage model.  As always, feedback is welcome.

 

 

 

WordPress Google Form v0.50 now available

WordPress v0.50 is now available.  This update fixes a jQuery syntax error which occurred when validation was but user email and CAPTCHA were off.  Along with the bug fix I also added CSS to hide the “Never submit passwords through Google Forms.” message that Google has added to forms.

You can find the update on your WordPress Dashboard or in the WordPress plugin repository.

WordPress Google Form v0.49 released

A pretty serious issue was reported in the Support Forum this afternoon.  I have found and fixed the bug and pushed out an update.  While I was at it, I also adjusted the default CSS so the Help Text for form fields is visible. I had inadvertently hidden it with CSS in the v0.46 release.

The update will appear on your WordPress Dashboard or you can find it in the WordPress plugin repository.

WordPress Google Form v.0.47 released

This morning I pushed out v0.47 of WordPress Google Form.  This update fixes a problem in which various combinations of options would result in jQuery syntax errors which in turn resulted in Javascript errors.  In some cases, the plugin would not properly complete, particularly when using checkboxes and/or custom confirmation pages.

You will see the update on your WordPress Dashboard or you can find it in the WordPress plugin repository.