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.

Define a dropdown on a previous page and select it automaticly in GravityForms

  1. Dear GravityForms,

    I have came up with a little issue with my graphical layout and the use of gravityforms. In the layout u can define a subject for a Mailform (GravityForms) on the homepage.

    Lets take an examlpe:

    <form id="form1" name="form1" method="post" action="/contact">
      <label>
        <select name="choice" id="select">
          <option value="First Choice">First Choice</option>
          <option value="Second Choice">Second Choice</option>
           <option value="Third Choice">Third Choice</option>
        </select>
      </label>
      <label>
        <input type="submit" name="button" id="button" value="Submit" />
      </label>
    </form>

    Now the form name is "choice" so in the top of the page with the gravityform init requests this postname:

    <?php
    $choice		= $_POST['choice'];
    ?>

    Now since we have selected "Second Choice" I want the subject in Gravityform's dropdown to be selected to.

    But actually i have no idea how i can edit this "dropdown" that gravityforms has.

    Is this possible ? ifso: how, am i doing it wrong or did u made a much easier solution to do this?

    Kind Regards,

    Rian

    Posted 13 years ago on Tuesday December 7, 2010 | Permalink
  2. I'm not entirely clear what you are trying to do. The code you posted above is not a Gravity Form. What exactly are you trying to accomplish?

    Posted 13 years ago on Tuesday December 7, 2010 | Permalink
  3. Dear Carl,

    When the idea is this.

    On the Homepage of the website. The visitors need to decide a reason why they contact the webmaster. This happends in a dropdown (like i stated above in html code).

    When a choice on the Homepage is made by a visitor in the dropdown. U should redirect to the wordpress page with gravity forms on it.

    Now that dropdown choice that has been made, needs to become the "subject" of gravityforms.

    Do u get the picture :) ?

    Kind Regards

    Rian

    Posted 13 years ago on Thursday December 9, 2010 | Permalink
  4. Okay here is what you need to do.

    1. Your hardcoded form is fine, except change the post method from POST to GET so that it uses GET and passes the selected value via the querystring. Change the post action for this form so that it points to your WordPress page containing your Gravity Form.

    2. Edit the Gravity Forms you want the hardcoded form to pre-populate.

    3. Add a drop down field to your form that contains the SAME exact values as the field hardcoded select field above. You can choose to display this or not on this form later, but either way it needs to exist.

    4. Edit the drop down field you created in step 3 above and go to the Advanced tab. Check the "Allow field to be populated dynamically" checkbox and enter a parameter name of "choice" without the quotes so it matches the name of the select field in Step 1 above.

    5. Save your form.

    Now if you setup the above steps properly, when you submit your hardcoded form it will use GET to go pass that value to the WordPress page containing your Gravity Form in the querystring as choice=SELECTEDVALUE. Your form will then pre-populate the drop down you created in Step 3 above with that value.

    Just keep in mind the values of the drop down in Step 1 and Step 3 above have to be identical so it can match up with an existing value.

    If you want to hide the drop down on your Gravity Form you can edit it, selected the Advanced tab and make the visibility Admin Only.

    Posted 13 years ago on Thursday December 9, 2010 | Permalink
  5. Thanks!! I followed your steps and it worked !

    Posted 13 years ago on Tuesday December 14, 2010 | Permalink