Or – how I do things since I can’t program – but isn’t the first title much more fun?
First off, thanks to Jim Groom for letting me bounce ideas off him, giving some technical assistance and for testing services rendered. Now to business.
Here’s what I wanted- a web accessible form that would display the data as it rolled in right under the submission form. Just like comments for a post but we wanted multiple questions and we wanted to be able to divide the responses. So that, in and of itself, is pretty narrow and stupid but what this can do in the end is pretty cool and can have widespread power. Using Google forms and the selective publishing option you can embed all sorts of user inputted data w/o having a clue how to program- and I think that’s pretty neat.
Obligatory Warning for WPMU users (WP single user should just work)- Some of the stuff I’m going to tell you to do is not a good idea if you’ve got other authors on your WPMU installation that you don’t trust. If it’s just you and people who won’t be doing crazy stuff then proceed under your own recognizance.
To make this work in WordPress MU you’re going to need to install one plugin - Unfiltered-mu. This basically lets you put in the iframe embed codes w/o WPMU stripping it out as unsafe.
So once you’ve done that, you can get down to business.
Embedding the form part is easy. Just log into google docs and select New>Form.
Once you’ve got it set up the way you want – save it. Then go to More Actions>Embed.
You’ll get a pop box with the iFrame code. Copy it. Go to your blog post or page (make sure you’re in HTML view) and paste it in.
Once it’s embedded you’ll see something like what’s below- and that is real. Go ahead put something in there and hit submit.
So that’s going to allow people to enter information. Now we need to take what they write and put it other places. Keep in mind you could have multiple questions of multiple types and display different chunks in as many different places as you’d like. Unfortunately, you can’t make multiple forms for one spreadsheet. That’d be awfully convenient at times.
Initially I was using the spreadsheet’s RSS feed to pipe the results back in. That’ll certainly work and you can use the embedrss plugin to make things easy. In the end, I didn’t go this route but might in the future. With the RSS feed I think you could control the look a lot better and decide how much recent data to show.
In the end I used the selective publishing options that Google SS has. I hadn’t messed with this before so I was surprised how flexible things turned out to be.
Step one – Go to the spreadsheet that was auto created when you made the form. Then publish the spreadsheet as a web page.
Make sure you click Automatically republish if you want it to update (also note that if the Republish button is yellow you need to press it to make your changes go into effect).
Once you’ve got that set up. Click on More Publishing Options. You’ll then put in the following info. Choose – HTML to embed in a web page. You can then decide which cells to show. It’s just like Excel here. I only have one question and it’s in column B so I chose B1:B55 but you could do things like B1:D55 or whatever. This is really handy for breaking your data up and showing different pieces in different places.
Now that you’ve got that set up the way you want- hit Generate URL AND cut and paste the HTML it made for you. Then paste it where you’d like your data to show up. I pasted the result below here. Notice too that the changes in formatting I made to the spreadsheet (the blue background) carried over to the embed. It seems like you have to republish to make that take effect. Meanwhile, the data from the form should pipe right in every five minutes or so.
So you can use this in lots of fun ways with the added benefit that the info is in a spreadsheet that you can use in lots of other ways.
The information you enter in the form should show up here in a few minutes.
As additional background, I got Jim involved in this originally when I trying to use Cformsii (which is awesome by the way) and its RSS feed to do this (which is a really cool feature). I stopped using it because the feed for new entries was only working globally, that is for all forms, and not per form which is what I wanted. The feed also seems to fail in Google reader but I’m not sure why that is b/c it validates… Things seemed erratic to me but there could be lots of variables causing that. The upside of using Cforms would be increased control over the form and its look. You would have to figure out how to format the subsequent feed via CSS though – which is both good and bad in my opinion.