• Hi –
    I’m having a little trouble setting this up just right. Here’s a link to my form

    I am using the old google forms.

    1) Once I’ve submitted the form if I go back I just get a blank page with a “*Required” instead of the goolge form. I assume this is because it doesn’t show the form twice for the same user cookie. How can I enable multiple submissions or at least a friendly message on this?

    2) I’d like to hide the field source and have it pre-populate based on the value of a shortcode I have defined in my WP instance. I made a shortcode to pull in a URL parameter and want to pass that parameter right into my google form in a hidden field. How do I do this in your add-in? So to be clear, I’d like to hide one of my fields (“Source”) and have it always default to the return value of a custom shortcode I wrote. Possible?

    3) Is there a standard width in pixels I should use for my pop-up box which is using your plugin so it shows up best?

    Thanks in advance!

    J

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mike Walsh

    (@mpwalsh8)

    1. Are you going back using the browser’s back button? If so, those results are unpredictable just like they are when you use a Google Form from Google Drive. What you should do is add a link to the page where the form appears on your confirmation page or to the confirmation page text so the user can click on it to initiate the whole process again.
    2. You can do this pretty easily. There is a whole section for hidden fields when you define the form as well as preset values. Additionally you can use Google’s capability to get a pre-populated form URL which you can use to define your form. You would simply define two (or more) instances of your form within WordPress, each using the appropriate pre-populated URL and hidden fields settings to make them unique. You would then use the two (or more) separate shortcodes to put the forms on the appropriate pages. There are a couple posts on my web site (like this one, or this one, or this one) which cover URL parameters, presets, and hidden fields.
    3. No idea. Anything related to the actual presentation of the form is very much theme dependent. Looking at your form, it is pretty simply so I would think something like 300px would be sufficient but it really depends on if you want the entry boxes bigger or not. I’ve never tried putting a form in a popup box so have no practical experience to speak from.
    Thread Starter joelevy

    (@joelevy)

    OK, this helps.

    1) Not using the browser back. Just reloading. Is there some field that only lets the form show once until cookies are reset?

    2) I see in your example how to pre-populate a field. What I don’t see is how to actually hide a field. How do I make a field in my google form hidden without actually editing the HTML?

    3) Thanks. Looks good.

    Thanks –

    Plugin Author Mike Walsh

    (@mpwalsh8)

    1. No idea. When the form is POSTed there is all sorts of stuff that Google keeps track of in addition to the fields from the form itself. If you “reload” a page, the browser may try and resubmit the form again. If you want a user to see the form again, the best way is to have them click on a link which loads the URL without any POST or GET parameters tagging along for the ride. Look at bullet #4 on this post – looks like I made a change at one point to handle the link for “Submit another response” to work correctly.
    2. There is a whole section of the GUI on the Dashboard for setting up hidden fields. WHen you define the form on the WordPress Dashboard look toward the bottom of the page – there is a section for hidden fields which you can expand. You need to know the entry ID which means you need to examine the HMTL of the form itself so you can determine the element ID to enter into the hidden field section. The process of identifying the element ID for hidden fields is the same as I outline for field validation in this post.
    Thread Starter joelevy

    (@joelevy)

    This is really helpful. I’m trying to pre-populate a hidden field with the value from a shortcode. So using your form I set “google form hidden fields” to on. Add a hidden field name (entry.1022020987). Set the type to value? Then the value is a return value from a shortcode [url_src] (which is a custom shortcode I wrote to get one of the specific URL parameters).

    Is this possible?

    Plugin Author Mike Walsh

    (@mpwalsh8)

    No, what you are trying to do isn’t possible. The hidden value has to be defined as part of the form definition. It isn’t possible to pick it up from the shortcode.

    The wpgform shortcode only supports two parameters – id and uid with only id being required.

    What you can do is create two instances of the same Google Form within WordPress (define two forms with the same URL) but set the hidden field for one to one value and the same hidden field for the second instance to a second value. Each form will have a unique id and thus can be referenced with separate shortcodes so you could call the shortcode for #1 when your custom shortcode determines that is correct and #2 when your code determines that is correct.

    You can have as many instances of the same target Google Form as you want and each will have a unique shortcode.

    Thread Starter joelevy

    (@joelevy)

    I got it done with some javascript after the page loaded. Thanks. Your plugin really is great. Hope google doesn’t depreciate the old forms before you’re able to get the new forms supported. Your solution is a life saver.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘trouble making form work’ is closed to new replies.