<?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: Combine custom fields to create the Post Title using pre-submission hook</title>
		<link>https://legacy.forums.gravityhelp.com/topic/combine-custom-fields-to-create-the-post-title-using-pre-submission-hook</link>
		<description>Gravity Support Forums Topic: Combine custom fields to create the Post Title using pre-submission hook</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:25:36 +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/combine-custom-fields-to-create-the-post-title-using-pre-submission-hook" rel="self" type="application/rss+xml" />

		<item>
			<title>mpiskie on "Combine custom fields to create the Post Title using pre-submission hook"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/combine-custom-fields-to-create-the-post-title-using-pre-submission-hook#post-4496</link>
			<pubDate>Tue, 06 Apr 2010 17:24:42 +0000</pubDate>
			<dc:creator>mpiskie</dc:creator>
			<guid isPermaLink="false">4496@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am looking to build the 'Post Title' based on user input. I have limited PHP knowledge although I was able to write the code below. I can extract the field values using $_Post and combine them into a variable, but I cannot figure out how to write them back to the 'Post Title' field.&#60;/p&#62;
&#60;p&#62;I am using the pre-submission hook since I want the title updated before it is saved. I am hoping this is just a silly syntax problem.  Can you share how to write to a calculated field value AFTER the form has been filled out and BEFORE it is posted to the database?&#60;/p&#62;
&#60;p&#62;PS: If would be awesome if I could have just dynamically combined fields in the form. Perhaps a future feature.&#60;/p&#62;
&#60;p&#62;Code:&#60;br /&#62;
add_action(&#34;gform_pre_submission&#34;, &#34;pre_submission_update_title&#34;);&#60;br /&#62;
function pre_submission_update_title($form){&#60;/p&#62;
&#60;p&#62; //create new post title e.g. Truck from Detroit, MI to Seattle, WA (3/20/2009)&#60;br /&#62;
 $newposttitle = &#34;Truck From: &#34;.$_POST[&#34;input_29&#34;].', '.$_POST[&#34;input_28&#34;].&#34; to &#34;.$_POST[&#34;input_26&#34;].&#34;, &#34;.$_POST[&#34;input_17&#34;].&#34; (&#34;.$_POST[&#34;input_27&#34;].&#34;)&#34;;&#60;/p&#62;
&#60;p&#62; //insert new title back into form (Post Title is ID #1)&#60;br /&#62;
 foreach($form[&#34;fields&#34;] as &#38;amp;$field){&#60;br /&#62;
	if($field[&#34;id&#34;] == &#34;1&#34;){&#60;br /&#62;
	      $field[&#34;value&#34;] = $newposttitle;&#60;br /&#62;
	}&#60;br /&#62;
  }&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
