PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

passing url parameter to gravity form

  1. omoplata
    Member

    How do I pass custom values to a gravity form? This custom value is needed to dynamically populate the fields.

    Also how do I set hidden form values?

    Posted 9 years ago on Tuesday July 17, 2012 | Permalink
  2. You can pass custom values to a page where Gravity Forms is embedded in the query string.

    Example: http://example.com/page-with-form/?email=username@gmail.com

    That will send the value "username@gmail.com" to the form embedded in the WordPress page with the slug of "page-with-form" and populate to form field with a parameter name of "email" (this you have to configure in your form.)

    For hidden form values, what do you mean?

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  3. omoplata
    Member

    by hidden, I mean:

    <input type="hidden" name="email" value="username@gmail.com">

    so as part of the form submission, a field and value are submitted, but are invisible/not part of the form UI

    The use case for this is that I have some meta data associated with a form that has nothing to do with the UI, but nevertheless needs to get POST as part of the form submission.

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  4. Will this information always be the same? You just want it recorded as part of the entry? Or do you have other plans for it?

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  5. omoplata
    Member

    The hidden values will be dynamic. Some will be set via query string sent to the form. Others might be client specific, like say timezone, browser type, IP, etc.

    None of these would be part of the form UI, but we would want it recorded as part of the form entry in the DB.

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  6. In that case, you can add the field to the form and set the Visibility of the field to "Admin Only" which will keep it hidden on the front end, but will record the information in the back end.

    Screenshot: http://minus.com/mKEwiiyRQ/

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  7. David Peralty

    You could also just hide the field using a CSS class. I add hidden to the CSS class of the fields I don't want to show up to the users. Then in my style.css I add

    .hidden { display:none; }
    Posted 9 years ago on Wednesday July 18, 2012 | Permalink
  8. omoplata
    Member

    Ah, those solutions are perfect! Thanks.

    Posted 9 years ago on Wednesday July 18, 2012 | Permalink

This topic has been resolved and has been closed to new replies.