<?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: How to prepopulate a field based on a previous field in the same form</title>
		<link>https://legacy.forums.gravityhelp.com/topic/how-to-prepolute-a-field-based-on-a-previous-field-in-the-same-form</link>
		<description>Gravity Support Forums Topic: How to prepopulate a field based on a previous field in the same form</description>
		<language>en-US</language>
		<pubDate>Wed, 08 Apr 2026 11:05:28 +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/how-to-prepolute-a-field-based-on-a-previous-field-in-the-same-form" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "How to prepopulate a field based on a previous field in the same form"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-prepolute-a-field-based-on-a-previous-field-in-the-same-form#post-67368</link>
			<pubDate>Sat, 21 Jul 2012 12:57:24 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">67368@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;For copying the value between fields on the same page, please see this:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/billing-same-as-shipping-address&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/billing-same-as-shipping-address&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>tylerrum on "How to prepopulate a field based on a previous field in the same form"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-prepolute-a-field-based-on-a-previous-field-in-the-same-form#post-67288</link>
			<pubDate>Fri, 20 Jul 2012 17:10:59 +0000</pubDate>
			<dc:creator>tylerrum</dc:creator>
			<guid isPermaLink="false">67288@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm trying to accomplish a similar goal but for a form on the same page as opposed to different pages. I have multiple sections on one form that are all identical but only show up (i.e., are conditional fields) when a user clicks &#34;Add another property&#34;. I'd like these new property fields to autopopulate with the info put in for the previous property. I've read around a bit, but I'm definitely a rookie when it comes to editing PHP or figuring out where to post the code snippets I've seen and how to properly format them. Any help would be great.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>redkite on "How to prepopulate a field based on a previous field in the same form"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-prepolute-a-field-based-on-a-previous-field-in-the-same-form#post-67251</link>
			<pubDate>Fri, 20 Jul 2012 12:48:55 +0000</pubDate>
			<dc:creator>redkite</dc:creator>
			<guid isPermaLink="false">67251@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've been looking around in the forums for a while and am using the code snippet from this post:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/populate-field-from-previous-field&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/populate-field-from-previous-field&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;This is my version of the code from functions.php, but it's not working:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// update &#38;quot;108&#38;quot; to the ID of your form
add_filter(&#38;quot;gform_pre_render_2&#38;quot;, &#38;quot;populate_previous_page_data&#38;quot;);
function populate_previous_page_data($form){

    $page_number = rgpost(&#38;quot;gform_target_page_number_{$form[&#38;quot;id&#38;quot;]}&#38;quot;);
    $page_number = !is_numeric($page_number) ? 1 : $page_number;

    foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field) {

        if($field[&#38;#39;id&#38;#39;] != 42.5) // update &#38;quot;15&#38;quot; to the ID of the field you wish to be populated;

        $field_page = rgar($field, &#38;#39;pageNumber&#38;#39;);

        if($page_number &#38;gt; $field_page)
            continue;

        // update this to the ID of the field whose value you wish to call
        // &#38;#39;16.3&#38;#39; = example, first name of a Name field
        // &#38;#39;16.6&#38;#39; = example, last name of a Name field
        $field[&#38;#39;defaultValue&#38;#39;] = rgpost(&#38;#39;1&#38;#39;);
    }
    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;My form is here, and I'm trying to prepopulate the Zip code field on the last page with the value entered on the first page. Can someone help?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
