<?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: gform_pre_render add title attribute to dropdown</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown</link>
		<description>Gravity Support Forums Topic: gform_pre_render add title attribute to dropdown</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 13:58:53 +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/gform_pre_render-add-title-attribute-to-dropdown" rel="self" type="application/rss+xml" />

		<item>
			<title>Alex Cancado on "gform_pre_render add title attribute to dropdown"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown#post-42798</link>
			<pubDate>Thu, 01 Dec 2011 18:11:58 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">42798@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would have to implement AJAX to be able to pull this off, but it is doable. Another alternative is to use a multi-page form with your drop down on the first page and the dependent field on the second page.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "gform_pre_render add title attribute to dropdown"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown#post-42793</link>
			<pubDate>Thu, 01 Dec 2011 17:54:56 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">42793@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;It's going to depend on what you are trying to do.&#60;/p&#62;
&#60;p&#62;If you want to set the value of a user visible field based on a drop down selection that triggers a query of your WordPress table and sets the value based on the selection, this is client side and would require you to write your own custom jQuery using AJAX to do this.&#60;/p&#62;
&#60;p&#62;If the field you are storing in does not need to be visible on the form you could do this server side.  Add a hidden field to your form, or a standard field set to visibility Admin Only, and then use the gform_pre_submission hook to 1) Execute your custom code to query the WordPress data you want to query based on the drop down selection and 2) Store that value in the field you created to contain it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>amax2222 on "gform_pre_render add title attribute to dropdown"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown#post-42779</link>
			<pubDate>Thu, 01 Dec 2011 17:20:42 +0000</pubDate>
			<dc:creator>amax2222</dc:creator>
			<guid isPermaLink="false">42779@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Ok thanks for the reply! Is there a way then to retrieve the value from a table within wordpress based on the selection of the pre-populated dropdown? ie. query the database based on the value of the dropdown. I guess because it is client side and not server side I need to think of another solution?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "gform_pre_render add title attribute to dropdown"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown#post-42764</link>
			<pubDate>Thu, 01 Dec 2011 16:50:37 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">42764@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The title attribute of the select option isn't currently output by Gravity Forms so passing it when populating the field dynamically isn't going to make it output when it is displayed.&#60;/p&#62;
&#60;p&#62;Currently the only thing utilizes is the value of the option and the text of the option which is what is displayed in the drop down.&#60;/p&#62;
&#60;p&#62;We can look at enhancing the hook to allow this in a future release, however it's not currently a built in option.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>amax2222 on "gform_pre_render add title attribute to dropdown"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_pre_render-add-title-attribute-to-dropdown#post-42741</link>
			<pubDate>Thu, 01 Dec 2011 12:01:02 +0000</pubDate>
			<dc:creator>amax2222</dc:creator>
			<guid isPermaLink="false">42741@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi&#60;br /&#62;
In summary I want to include the title attribute in the option of my prepopulated dropdown using the gform_pre_render filter.&#60;br /&#62;
I am using the code provided for the gform_pre_render to prepopulate a dropdown with a query from my database. It works great in passing the value and text attributes but I would also like to include the 'title' attribute in the 'option' but not sure how. I have included it in my $items array but is not getting passed through. Here is my code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;foreach($races as $race) {

	$items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $race[&#38;#39;title&#38;#39;], &#38;quot;text&#38;quot; =&#38;gt;$race[&#38;#39;title&#38;#39;], &#38;quot;title&#38;quot; =&#38;gt;$race[&#38;#39;distance&#38;#39;]);
	foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
	if($field[&#38;quot;id&#38;quot;] == 1){
	$field[&#38;quot;choices&#38;quot;] = $items;
	}
	return $form;
	}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
