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

This evening I posted a new beta release (#4) of WordPress Google Form v0.54.  This beta release addresses a problem where values with escape characters and/or other encoded characters end up in the response spreadsheet.



As you can see in the image above, the values are escaped until the final entry.  This fix needs some testing to make sure it doesn’t break anything, please try it out and let me know how you make out.

Google Forms Beta (1457 downloads)

Theme Experiments with TwentyTen and Git

I am doing some experiments with the TwentyTen theme and Git.  Up until very recently I have never used Git, I’ve done all of my version control with Subversion.  With Git gaining in popularity, I see more and more WordPress projects using it.  I figured I ought to educate myself.

I recently picked up the O’Reilly Version Control with Git book.  On a recent trip to Phoenix and back I read through a fair amount of it.  I have found that nothing forces you to learn how to do or use something like having a real problem to solve.  You can take training classes, read books, attend lectures, etc. but you’ll never really learn until you have to actually have to apply the material to solve a real problem.

It was like that for me with Git.  While I’ve used Subversion for quite a while, I was having a tough time getting my arms around the concepts of forks, pushes, pulls, etc.  For all practical purposes, I still am but I am getting there.

I like the idea of child themes.  I have no desire to completely reinvent the wheel.  The  guys who put out WordPress are smart and clever and have done some nice themes that work well.  In particular, I like TwentyTen as a parent theme and have done a couple child themes from it.  I find myself using some of the same ideas and plugins across these theme projects so what I’d really like is a core child theme that I can adapt or build from that contains all of the things I like and have figured out already.

So while reading up on Git I envisioned being able to use it to build a base theme that I could adapt to several others very quickly.  If I made a change it would propagate out to the other themes that are based on the base theme.  At least that is the theory.  I am still not sure if it will work like that or not but I’ve decided to try.

For the past day or so I’ve assembled a TwentyTen child theme I am calling TwentyTen-ACME.  Why ACME?  Because it is a pretty generic name.  ACME was the company that provided everything to Wile E. Coyote in the Road Runner cartoons.  ACME is the definition of generic!

So now that I have my base theme pretty much done, I am going to build a derivative from it for a project I am doing for our middle school.  Shortly there after I am going update my LEGO theme which is based on Sandbox and is long overdue for an update.  I am hoping that as I need to push changes back to the base theme I will be able to flow them back out to the others quickly.  We’ll see.

Changes to Age Groups

I am working on some new functionality to support mixed gender events.  While I am at it I have decided to fix a limitation with the current Age Groups where the need to define overlapping age groups works but causes some discrepancies on the roster and other reports.

I have enhanced the definition of an Age Group so it can either be “Standard” (which is what it has always been) or “Combined”.  A combined age group can support mixed genders and/or age ranges that span multiple age groups.  By differentiating two types of age groups it cleans up the issues with overlapping age groups too.

Here are a couple of screen shots of what the changes look like.  I am running through some testing now to make sure everything still works.

wpst_SS_03 wpst_SS_04

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 (1457 downloads)

GForm_SS_52 GForm_SS_53 GForm_SS_54

WordPress Google Form v0.54-beta-1 available

The first beta release of WordPress Google Form v0.54 is now available for download. This beta release introduces a pretty significant enhancement – Advanced Validation for any field on a Google Form. This is an “advanced” feature as it requires the user to dig into the form in order to gather the necessary information for the validation to work correctly.

There are a few things which I know aren’t working (e.g. Range Checks) which I will look into.  I would really appreciate some feedback on this new functionality.

Google Forms Beta (1457 downloads)

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.

Debugging a weird one

Yesterday I was contacted by a WordPress Google Forms user who was getting a permission denied problem when submitting his form.  After trying a number of obvious things (like disabling all other plugins), I asked him to try switching to one of the default WordPress themes.  He switched the site over to use TwentyTwelve and the problem went away.  Yeah!  I was worried that we might be dealing with another ModSecurity problem.

So we narrowed the problem down to something in his theme but what would generate a 403 error?  The user was gracious enough to let me have access to his site.  By enabling Debug, I was able to see a dump of the header information.  The header information showed a redirect was being requested (makes sense due to 403).

Using Firebug I could see that the POST variables looked correct.  Oops, maybe not.  Everything looked ok except a hidden variable that Google uses in forms to pass information between the pages of multi-page forms.  Even single page forms have this hidden variable.  On the initial load of the form, this variable should be empty (a null string) but it wasn’t.  How could that happen?

Looking at the HTML page source for the form, I could see there was quite a bit of odd stuff in the form code.  It doesn’t come from Google, where does it come from?  Because form submission worked with TwentyTwelve but didn’t work with the user’s theme, I suspected there was a filter mucking with the HTML.

Sure enough, digging through the theme’s functions.php file I found a custom filter that did several things, one of which was make a call to wptexturize().  Well that would certainly explain the manipulated HTML.

The next step was to comment out the calls to the filter to verify that was indeed the problem.  As expected, the form submitted without any issues.  At that point I wasn’t sure what to tell the user.  We could have left the filters commented out but they are part of the theme and there for a reason.  I decided to look at the filter a little closer.  It turns out, the theme defines a short code, actually, it doesn’t define one, the filter looks for one, called [raw][/raw] and if it finds it, leaves the content between the short code tags untouched.

Well this will work!  So I created a test page and placed the wpgform short code between [raw][/raw] and sure enough, the form submitted properly.

While I don’t like what the theme is doing, at least there was a work-around for it.  Unfortunately there is no way (yet) to accomplish the same thing with the Form URL.

This whole process took a couple of hours – far more than I am typically able to spend helping people but I was genuinely curious what was going on.  I am glad we got the user up and running.

I am trying to think of a good way for people to define forms which can handle such a situation.  I can define a hook but that means people need to write some code to use it or I could define more options for the plugin that allow the generated HTML to be wrapped in some prefix and suffix text (plain or HTML).  I am not sure what to do so will continue to think about it for a day or two.

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.