We use two form systems here at John Carroll, Wufoo and Gravity Forms. Something we do often in Wufoo is pre-populate form fields using URL strings.

I recently found myself needing to do that in Gravity Forms and realized that while it takes a few more steps than Wufoo, which you can do via the form’s URL, you need to do some edits in your form first.

When updating your form, find the field you’d like to be able to update via the URL string, and select the advanced tab of that field. Find the checkbox that says to allow that field to be populated dynamically. Check it and then give that field a name. This is how you’ll send it a value via the URL.

Screenshot 2014-07-09 11.55.25

Now, in your URL, you can call http://highedwebtech.com/pathto/form?areastosupport=value and that field will contain your value. This works for checkboxes, radio buttons and freeform text fields. If you have conditional logic, passing the variable will make sure any logic questions are processed. I have tried this in practice and it works really well. I didn’t seem to notice the order of the variables in the URL affecting the logic, but YMMV.

For checkboxes, you can put values in commas, so areastosupport=1,2 will check two boxes. For longer strings, seperate your text with + (plus signs.) That would look like areastosupport=This+is+my+string.

You can pass as many variables as you want, including admin and hidden fields, as long as you set them up ahead of time. You would add an ampersand between fields, such as http://highedwebtech.com/pathto/form?areastosupport=value&namefield=Name&emailcode=TRD&greeting=Hello+From+Mike.

Gravity Forms Plugin for WordPress

We’ve been testing Gravity Forms here as part of our WordPress CMS, allowing users easy access to be able to make forms and manage them right inside WordPress. So far, our tests have been positive, and we’re set to open it up to all our users.

We’ve run into a challenge though as we get ready to roll this out. When set up and turned on in one of our sites (we run multi-site), only administrative users could access and see Gravity Forms.

We set up our campus users as editors, so they can’t go and switch themes and install rogue plugins. Even though the plugin was installed, editors couldn’t see Gravity Forms. They could see all our other functions and custom post types, but not Gravity Forms.

I wrote to their support, who suggested I use yet another plugin. That’s fine if I was just running one site, but at 140 sites and growing, I can’t be spending all day in that plugin turning things on and off. I figured there’d have to be a way to give the editor role access.

Enter some code. It’s one of the things that I really love about WordPress. With a bit of good code, you can do a lot of different things.

I added the following to my functions.php file, making Gravity Forms see that the user role of editor had the correct privileges and could run it. After some trial and error, I found the following snippet of code worked for an editor:

	function add_grav_forms(){
		$role = get_role('editor');

So far, so good. I can make new forms, see entries and more as an editor, and I think I won’t have to manage this with a plugin, which is good to avoid that overhead where possible. Here’s what an editor sees now. The other things (taters, tots, etc) are custom post types we’ve developed.