<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: drop down value on form 1 determines which form 2 is displayed</title>
		<link>https://legacy.forums.gravityhelp.com/topic/drop-down-value-on-form-1-determines-which-form-2-is-displayed</link>
		<description>Gravity Support Forums Topic: drop down value on form 1 determines which form 2 is displayed</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 03:26:46 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/drop-down-value-on-form-1-determines-which-form-2-is-displayed" rel="self" type="application/rss+xml" />

		<item>
			<title>info@rezon8.net on "drop down value on form 1 determines which form 2 is displayed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-value-on-form-1-determines-which-form-2-is-displayed#post-286587</link>
			<pubDate>Wed, 29 May 2013 11:24:00 +0000</pubDate>
			<dc:creator>info@rezon8.net</dc:creator>
			<guid isPermaLink="false">286587@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Here is what I am trying to put together:&#60;/p&#62;
&#60;p&#62;Form 1 has two dropdown fields, one of which is which state do you live in?&#60;br /&#62;
I would like to set the dropdown for state on form 1 to redirect to a specific url based on the state the user selects.&#60;/p&#62;
&#60;p&#62;There are 50 pages containing a different form 2, a page for each state with a unique form. The page slug for these corresponding pages are each state's 2 letter abbreviation.&#60;/p&#62;
&#60;p&#62;Need to target dropdown field to validate based on css class assigned.&#60;/p&#62;
&#60;p&#62;Target dropdown contains US states.&#60;br /&#62;
Each state triggers a gorm_confirmation to redirect to site_url(CUSTOM) ELSE a static redirect url if no match.&#60;/p&#62;
&#60;p&#62;Dynamically build site_url(CUSTOM) where (CUSTOM) = /2 letter state code (the value selected in the state dropdown field)&#60;/p&#62;
&#60;p&#62;Match US state selected in dropdown on form 1 to the site_url(CUSTOM) and redirect.&#60;br /&#62;
basically matching the dropdown field value to the page slug for redirect.&#60;/p&#62;
&#60;p&#62;To target this validation and confirmation I would like to add a css class to the field and thought the code below (found in the forum here for vin number validation) would allow.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;1 - Tie our validation function to the &#38;#39;gform_validation&#38;#39; hook

add_filter(&#38;#39;gform_validation&#38;#39;, &#38;#39;state-redirect&#38;#39;);
function state_redirect($validation_result) {

    // 2 - Get the form object from the validation result
    $form = $validation_result[&#38;quot;form&#38;quot;];

    // 3 - Get the current page being validated
    $current_page = rgpost(&#38;#39;gform_source_page_number_&#38;#39; . $form[&#38;#39;id&#38;#39;]) ? rgpost(&#38;#39;gform_source_page_number_&#38;#39; . $form[&#38;#39;id&#38;#39;]) : 1;

    // 4 - Loop through the form fields
    foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field){

        // 5 - If the field does not have our designated CSS class, skip it
        if(strpos($field[&#38;#39;cssClass&#38;#39;], &#38;#39;validate-vin&#38;#39;) === false)
            continue;

        // 6 - Get the field&#38;#39;s page number
        $field_page = $field[&#38;#39;pageNumber&#38;#39;];

        // 7 - Check if the field is hidden by GF conditional logic
        $is_hidden = RGFormsModel::is_field_hidden($form, $field, array());

        // 8 - If the field is not on the current page OR if the field is hidden, skip it
        if($field_page != $current_page &#124;&#124; $is_hidden)
            continue;

        // 9 - Get the submitted value from the $_POST
        $field_value = rgpost(&#38;quot;input_{$field[&#38;#39;id&#38;#39;]}&#38;quot;);

        // 10 - Make a call to your validation function to validate the value
        $is_valid = is_state($field_value);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Any help would be greatly appreciated!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>info@rezon8.net on "drop down value on form 1 determines which form 2 is displayed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-value-on-form-1-determines-which-form-2-is-displayed#post-284837</link>
			<pubDate>Tue, 28 May 2013 23:20:45 +0000</pubDate>
			<dc:creator>info@rezon8.net</dc:creator>
			<guid isPermaLink="false">284837@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Trying to clarify. I have a dropdown for US states, I need each state selected on the first form to redirect to a different url on my site which contains the proper second form. Any ideas?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>info@rezon8.net on "drop down value on form 1 determines which form 2 is displayed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-value-on-form-1-determines-which-form-2-is-displayed#post-278367</link>
			<pubDate>Sun, 26 May 2013 12:39:35 +0000</pubDate>
			<dc:creator>info@rezon8.net</dc:creator>
			<guid isPermaLink="false">278367@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;First I would like to have a drop down value on my first form direct which form is loaded second.&#60;br /&#62;
Second, I am trying to load the second form within the same area on the same page rather than a confirmation or redirect, replacing the area previously taken by form 1. As if it was a page 2 of the form. My second form(s) accept query string to populate hidden fields.&#60;/p&#62;
&#60;p&#62;Alternately could I change the short code form number dynamically based on a dropdown value on form 1?&#60;/p&#62;
&#60;p&#62;Any suggestions?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
