<?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: Updating field labels</title>
		<link>https://legacy.forums.gravityhelp.com/topic/updating-field-labels</link>
		<description>Gravity Support Forums Topic: Updating field labels</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 11:08:20 +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/updating-field-labels" rel="self" type="application/rss+xml" />

		<item>
			<title>psm9640 on "Updating field labels"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-field-labels#post-15126</link>
			<pubDate>Tue, 28 Dec 2010 23:31:53 +0000</pubDate>
			<dc:creator>psm9640</dc:creator>
			<guid isPermaLink="false">15126@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This worked perfectly. Thank you David!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Updating field labels"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-field-labels#post-15121</link>
			<pubDate>Tue, 28 Dec 2010 19:39:34 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">15121@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Give this a go:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastebin.com/fb0TR0Cv&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/fb0TR0Cv&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Quick Summary&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;Using the &#60;strong&#62;gform_pre_render&#60;/strong&#62; hook we can not only update the field value but also the field label. A few lines to note:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;global $post;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This makes the post global object available to our hook function.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$field_index = get_field_index_by_id($form[&#38;#39;fields&#38;#39;], 1);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This line sets the &#60;strong&#62;$field_index&#60;/strong&#62; variable to the index of the field of whatever field ID you pass to the &#60;strong&#62;get_field_index_by_id()&#60;/strong&#62; function. This function is just a little utility function to protect your code from any changes in field order you may make to the form.&#60;/p&#62;
&#60;p&#62;In this example &#34;1&#34; is the ID of the field we want to change the label for.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$form[&#38;#39;fields&#38;#39;][$field_index][&#38;#39;label&#38;#39;] = get_post_meta($post-&#38;gt;ID, &#38;#39;question&#38;#39;, TRUE);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This line sets the label of our selected field to the post meta value for the &#34;question&#34; post meta key for the current post. Update &#34;question&#34; to the name of the meta key you are using to store the question for each post.&#60;/p&#62;
&#60;p&#62;Hope that helps! :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>psm9640 on "Updating field labels"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-field-labels#post-15120</link>
			<pubDate>Tue, 28 Dec 2010 19:36:28 +0000</pubDate>
			<dc:creator>psm9640</dc:creator>
			<guid isPermaLink="false">15120@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;*UPDATE*&#60;/p&#62;
&#60;p&#62;Okay so I've now successfully targeted the label of the form field using this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render_1&#38;#39;, &#38;#39;update_label&#38;#39;);
function update_label($form) {

    $question = &#38;#39;This is a test question&#38;#39;;

    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 24){
            $field[&#38;quot;label&#38;quot;] = $question;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;So I guess all I need to figure out now is how to pass the post ID to the filter...will keep working on it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>psm9640 on "Updating field labels"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/updating-field-labels#post-15117</link>
			<pubDate>Tue, 28 Dec 2010 18:46:03 +0000</pubDate>
			<dc:creator>psm9640</dc:creator>
			<guid isPermaLink="false">15117@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey guys - This might be a strange question but I'm stumped...&#60;/p&#62;
&#60;p&#62;What I'm trying to accomplish is have a single form that has a field label/question that is dynamically updated depending upon what page the user is on (questions are saved as a post meta value, the answer options are always &#34;Yes&#34; and &#34;No&#34;).&#60;/p&#62;
&#60;p&#62;I've created a &#34;dummy&#34; form field in the form admin, but in order to grab the question that should replace the dummy field label, I need to pass the actual post ID of the current page to the filter and I can't figure out how to do it. I can make the ID available via a $_GET or $_REQUEST, and I don't need to update the answers since I know they'll always be yes and no.&#60;/p&#62;
&#60;p&#62;I've had success using gform_pre_render on updating actual values of form fields but I've hit a wall on this one. Thanks in advance for any insight/help.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
