wp-SwimTeam v1.40-beta-1 now available

I have uploaded a preliminary build of wp-SwimTeam v1.40-beta-1.  This build introduces new functionality to support mixed gender and combined age groups.  It also fixes a number of small bugs I encountered along the way.

I have not done thorough testing on it as I don’t have access to MM and TM right now to validate the changes.  However, I am reasonably confident that the changes I’ve made will have little to no impact on Hy-tek compatibility.

If you run into any issues, let me know and I’ll get them fixed as quickly as I can.

wp-SwimTeam Beta (2523 downloads )

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-3 now available

A quick bump to beta-3 for WordPress Google Form v0.54 to fix a problem which resulted in a PHP error message due to missing post meta data for field validation.  Forgot to account for the situation where a form hasn’t defined any fields to validate!

Google Forms Beta (8965 downloads )

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 (8965 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.

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.

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.