This afternoon I spent some playing with a jQuery Form Validation plugin to determine if it will help me resolve the issue with required fields. The initial results look fairly promising as I was able to tag a couple fields on a test form and they were flagged when I submitted it.
In the image above, the jQuery Validation plugin added the “Thus field is required” when I submitted the form with those fields empty. This is exactly the behavior I want, the challenge now is to scale my Proof of Concept (PoC) to work in the generic case of the plugin. The Google form defines a block for each input field and the class the denotes a field as required is assigned to one of the DIV blocks that wraps the label and form element (e.g. INPUT or TEXTAREA tag) as opposed to the form element tag itself. This makes finding the required elements a little tricky.
The real challenge I think will be input groups (e.g. radio buttons and check boxes). I need to do some jQuery research before I have a solution but assuming I can figure out which elements to select, I believe this will solve the problem with required fields.
Google forms allow fields to be designated as required. When running the form using the standard Google URL, the form will be validated and presented back to the user if any of the required fields are not entered. There is an issue (aka bug) with required fields in the current version of the plugin.
If a user submits a form that is embedded in WordPress using the plugin, because there are missing fields the form processing does not complete. There is no indication for the user that something is wrong, the form is simply presented again without any of the fields having data in them.
To resolve this I am looking at doing form validation on the client side using a jQuery plugin. Hopefully I will have this resolved fairly quickly as I need this to work correctly for my own project. My testing didn’t take into account a user not completely the form correctly. Oops. This bug affects all versions of WordPress Google Form up to and including v0.9.
I have added the missing screen shots to the WordPress Google Form plugin.
The plugin has been updated to v0.9 and will appear in the WordPress Updates on the Dashboard.
Over the past 24 hours I have committed a number of changes to my wpGFrom plugin. The WordPress auto update process sometimes takes a little while to recognize a new version is out there but v0.8 should appear fairly soon. I actually updated it a couple times so you may have seen v0.6 and/or v0.7 show up as well.
Off and on over the past few weeks I’ve been working on a Thematic child theme. I’ve always had a hesitation with child themes in that you need the parent theme in order for the child theme to work. Duh. While it may be pretty obvious to anyone who is familiar with WordPress, it isn’t so for the casual user.
When I was working with Sandbox I figured out a way to essentially build a child theme while ensuring that the parent theme dependency wasn’t an issue by including all of the Sandbox code using a SVN external reference to Sandbox and some other tricks to include the code. It worked well and I was able to distribute my themes without concern as to whether or not Sandbox was installed. It simply didn’t matter.
I was not planning to do that with the Thematic child theme I am working on right now but am having second thoughts. It turns out that the version of Thematic that I need (0.9.8) is not the version which is in the WordPress Theme Repository and I have no idea when this will change.
If I got the SVN external route again I can ensure that my child theme will work with a known revision of Thematic. However, it is a fundamental shift in my approach and I don’t know if it will work the same way I did it with Sandbox. Decisions, decisions.
It looks like there have been some recent commits to the Thematic SVN repository so maybe it will be updated and released soon. That would help address my dilemma.
I have just committed v0.5 of the WordPress Google Form plugin. It addresses the problem with the Tabs on the Settings page not working correctly. It turns out that I had a couple of problems which were masked by the theme I was using. I have moved my development environment back to the stock Twenty-Eleven theme and turned off all other plugins.
By doing this I determined that the jQuery UI libraries I expected to be loaded, were in fact, not loaded at all. They were being loaded by the theme! Once I got the libraries loaded correctly the Tabs started working but they didn’t have the proper styling. WordPress doesn’t appear to include the jQuery UI CSS so I ended up loading it from Google’s CDN.
Everything seems to be working correctly now, v0.5 should appear as an update shortly if it hasn’t already.
The WordPress Google Forms settings page makes use of tabs to show information about the plugin and set its options. It appears that the theme I was using, which I am in the process developing, is the culprit. It loads some new jQuery functionality from Google’s API that apparently allowed the tabs to work as I expected. I am not sure yet why the builtin WordPress jQuery functionality isn’t working correctly as I expect it should.
Now that I know where the problem is, I think it should be pretty straight forward to fix it.
I’ve spent some time over the last couple of days cleaning up the WordPress Google Form plugin I’ve been working on and getting it added to the WordPress plugin repository. I am happy report that I think I have a stable version (v0.4) finally available that people can play with.
I’ve added a Sample Form and the corresponding Sample Results collected from form submissions if you are interested in seeing what the plugin looks like in action.
This plugin resulted from a need to collect data in a simple manner that could be managed in a spreadsheet. Google Docs provides an easy to use spreadsheet that be used to store the data. Google Forms provides a mechanism to design a form that can add data to the spreadsheet. The WordPress Google Form plugin allows the form to be added to a WordPress site and maintain the look and feel of the active theme.
Note: It looks like I didn’t flush out all of the bugs – the tabs on the Settings page are not working correctly!
For the past couple of days I have been working on a new WordPress plugin I am calling WordPress Google Form. This morning I received the approval for adding it to the WordPress plugin repository so I will be doing that over the next couple of days. I spent much of the last two days on an airplane so the plugin is currently in a state where I have it modified to work offline but I’ve done enough online testing that I am pretty confident I have something working.
My interest in Google Forms stems from the work I am doing on a site for our Middle School. We have a need to collect information in the form of Booster Club memberships and while there are a number of Membership type plugins, none of them really do what I want. Ultimately what we need is a spreadsheet of names, addresses, and phone numbers and Google Docs will work well for that. Putting a Google Form on the front end will allow us to capture the data online.
I thought integrating the Google Form with our WordPress site would be pretty simple, Google offers the ability to embed a form using an IFRAME. Unfortunately the ability to style the form is pretty limited and the Confirmation page even less so.
I have been using the Google Inline Spreadsheet Viewer plugin to display the data from our Google spreadsheets, I was somewhat surprised to find that there doesn’t seem to be anything similar for Google Forms. So I decided to write one. Borrowing some ideas from the Google Inline Spreadsheet Viewer plugin, I have created a plugin that defines the shortcode gform. The gform shortcode takes a Google Forms URL and extracts the FORM body content, cleans it up, and outputs it for WordPress posts, pages, and widgets.
There are a number of attributes that can optionally control the output, the most significant is the confirmation page which can redirect to a page within the WordPress site instead of the default Google conformation page.
More details to follow soon and I hope to have an example up and running later today.