<?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 User Favorites: kyle</title>
		<link><a href='https://legacy.forums.gravityhelp.com/profile/kyle'>kyle</a></link>
		<description>Gravity Support Forums User Favorites: kyle</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 04:30:50 +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/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>kyle on "Drop down dynamic population from single line text"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-dynamic-population-from-single-line-text#post-44928</link>
			<pubDate>Sun, 25 Dec 2011 19:11:34 +0000</pubDate>
			<dc:creator>kyle</dc:creator>
			<guid isPermaLink="false">44928@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I was intrigued by this one, so I took a stab at it.  Stealing a bit from &#60;a href=&#34;http://www.gravityhelp.com/forums/topic/counting-responses#post-43591&#34; rel=&#34;nofollow&#34;&#62;here&#60;/a&#62; and &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Dynamically_Populating_Drop_Down_Fields&#34; rel=&#34;nofollow&#34;&#62;here&#60;/a&#62; I came up with the following.&#60;/p&#62;
&#60;p&#62;First.. create your dropdown field.  Set the single option text to &#34;Add New City&#34; and the value to '' (blank).  Click Advanced, and give it a class of &#34;populate-city&#34;.&#60;/p&#62;
&#60;p&#62;Add a second field below that.  GIve it a title of New City.  Make a note of the field ID.  Set the Conditional tag to only show if your dropdown is set to ADD NEW CITY.&#60;/p&#62;
&#60;p&#62;Then, in your functions.php file, add the following:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php

// update the &#38;#39;2&#38;#39; in gform_pre_render_2 to the ID of your form
add_filter(&#38;#39;gform_pre_render_2&#38;#39;, &#38;#39;populate_cities&#38;#39;);

function populate_cities($form){

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

        if($field[&#38;#39;type&#38;#39;] != &#38;#39;select&#38;#39; &#124;&#124; strpos($field[&#38;#39;cssClass&#38;#39;], &#38;#39;populate-city&#38;#39;) === false)
            continue;

        // get previous entries user-added cities
        // update the 4 below to the field ID of your &#38;quot;New City&#38;quot; field
        $cities = get_entry_field_values(4, $form[&#38;#39;id&#38;#39;]);

         // update &#38;#39;City Dropdown
        $choices = array();

        foreach($cities as $city){
            $choices[] = array(&#38;#39;text&#38;#39; =&#38;gt; $city[&#38;#39;value&#38;#39;], &#38;#39;value&#38;#39; =&#38;gt; $city[&#38;#39;value&#38;#39;]);
        }
        $choices[] = array(&#38;#39;text&#38;#39; =&#38;gt; &#38;#39;Add New City&#38;#39;, &#38;#39;value&#38;#39; =&#38;gt; &#38;#39;&#38;#39;);
        $field[&#38;#39;choices&#38;#39;] = $choices;

    }

    return $form;
}

function get_entry_field_values($field_id, $form_id) {
    global $wpdb;

    $tablename = $wpdb-&#38;gt;prefix . &#38;#39;rg_lead_detail&#38;#39;;

    return $wpdb-&#38;gt;get_results($wpdb-&#38;gt;prepare(&#38;quot;SELECT value FROM $tablename WHERE form_id = %d AND field_number = %d&#38;quot;, $form_id, $field_id), ARRAY_A);         

}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You may want to sort the choices array, and check for duplicates, not to mention make sure the formatting [capitalization, etc.] is correct, but I'll leave that up to you.  When someone goes to fill out the form, they'll see a list of previously added cities.  They can choose that or choose &#34;ADD NEW CITY&#34; and use the input field that appears to enter their city name.  &#60;/p&#62;
&#60;p&#62;Hope it helps.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MiikkaMakio on "Drop down dynamic population from single line text"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-dynamic-population-from-single-line-text#post-44922</link>
			<pubDate>Sun, 25 Dec 2011 03:14:26 +0000</pubDate>
			<dc:creator>MiikkaMakio</dc:creator>
			<guid isPermaLink="false">44922@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Anyone?&#60;/p&#62;
&#60;p&#62;I've made couple changes to the names of the fields.. I know this is not too difficult thing but can't get it working!&#60;/p&#62;
&#60;p&#62;What would I need to add to get the dynamic population to work for the 'Kaupunki' drop down?&#60;br /&#62;
If the Kaupunki that the form user wants to select is not ready in the drop down list, he would be able to write to the 'Kaupunki jos ei listalla' and next user of the form would see that one in the 'Kaupunki' drop down.&#60;br /&#62;
I tried to follow the guide and read bunch of topics many times, but didn't quite get how I should determine that it takes the text from the 'Kaupunki jos ei listalla' etc.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Custom Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-fields-4#post-44131</link>
			<pubDate>Thu, 15 Dec 2011 07:03:51 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">44131@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Great! Glad you were able to get this resolved. :)&#60;/p&#62;
&#60;p&#62;I'm going to close this topic now; but feel free to post a new topic if any other questions come up.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anonymous on "Custom Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-fields-4#post-44125</link>
			<pubDate>Thu, 15 Dec 2011 05:19:42 +0000</pubDate>
			<dc:creator>Anonymous</dc:creator>
			<guid isPermaLink="false">44125@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi David,&#60;/p&#62;
&#60;p&#62;The original tutorial is this one:&#60;br /&#62;
&#60;a href=&#34;http://wefunction.com/2009/10/revisited-creating-custom-write-panels-in-wordpress/&#34; rel=&#34;nofollow&#34;&#62;http://wefunction.com/2009/10/revisited-creating-custom-write-panels-in-wordpress/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I've actually managed to modify the code so that each custom field creates a new row in the database - as I understand it, although this will add extra load on the database, this will make the data/fields more easily searchable and usable (for creating custom field archives, filters, etc.)&#60;/p&#62;
&#60;p&#62;For anyone else having a similar issue here's the new, modified code, which GF can pick up:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;/* Custom Fields */
$key = &#38;quot;key&#38;quot;;
$meta_boxes = array(
&#38;quot;cf_link&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_link&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;URL/Link&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter the URL/Link here.&#38;quot;),
&#38;quot;cf_image&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_image&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;Image&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter the image URL here.&#38;quot;),
&#38;quot;cf_instructions&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_instructions&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;Instructions&#38;quot;,
&#38;quot;type&#38;quot; =&#38;gt; &#38;quot;textarea&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter any specific instructions here.&#38;quot;)
);

function create_meta_box() {
global $key;

if( function_exists( &#38;#39;add_meta_box&#38;#39; ) ) {
add_meta_box( &#38;#39;new-meta-boxes&#38;#39;, ucfirst( $key ) . &#38;#39;Product Details&#38;#39;, &#38;#39;display_meta_box&#38;#39;, &#38;#39;products&#38;#39;, &#38;#39;normal&#38;#39;, &#38;#39;high&#38;#39; );
}
}

function display_meta_box() {
    global $post, $meta_boxes, $key;
?&#38;gt;
    &#38;lt;div class=&#38;quot;form-wrap&#38;quot;&#38;gt;
&#38;lt;?php
    wp_nonce_field( plugin_basename( __FILE__ ), $key . &#38;#39;_wpnonce&#38;#39;, false, true );

    foreach($meta_boxes as $meta_box) {
        $data = get_post_meta($post-&#38;gt;ID, $meta_box[&#38;#39;name&#38;#39;], true);
?&#38;gt;
    &#38;lt;div class=&#38;quot;form-field form-required&#38;quot;&#38;gt;
    &#38;lt;label for=&#38;quot;&#38;lt;?php echo $meta_box[ &#38;#39;name&#38;#39; ]; ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php echo $meta_box[ &#38;#39;title&#38;#39; ]; ?&#38;gt;&#38;lt;/label&#38;gt;
&#38;lt;?php if( $meta_box[&#38;#39;type&#38;#39;] === &#38;#39;textarea&#38;#39; ) { ?&#38;gt;
  &#38;lt;textarea name=&#38;quot;&#38;lt;?php echo $meta_box[ &#38;#39;name&#38;#39; ];?&#38;gt;&#38;quot; rows=&#38;quot;4&#38;quot;&#38;gt;&#38;lt;?php echo htmlspecialchars($data); ?&#38;gt;&#38;lt;/textarea&#38;gt; 

&#38;lt;?php } else { ?&#38;gt;

  &#38;lt;input type=&#38;quot;text&#38;quot; name=&#38;quot;&#38;lt;?php echo $meta_box[&#38;#39;name&#38;#39;]; ?&#38;gt;&#38;quot;
      value=&#38;quot;&#38;lt;?php echo htmlspecialchars($data); ?&#38;gt;&#38;quot; /&#38;gt;&#38;lt;?php }?&#38;gt;
&#38;lt;p&#38;gt;&#38;lt;?php echo $meta_box[ &#38;#39;description&#38;#39; ]; ?&#38;gt;&#38;lt;/p&#38;gt;
&#38;lt;/div&#38;gt;
&#38;lt;?php } ?&#38;gt;
&#38;lt;/div&#38;gt;

&#38;lt;?php
}

function save_meta_box( $post_id ) {
global $post, $meta_boxes, $key;

foreach( $meta_boxes as $meta_box ) {
$data[ $meta_box[ &#38;#39;name&#38;#39; ] ] = $_POST[ $meta_box[ &#38;#39;name&#38;#39; ] ];
}

if ( !wp_verify_nonce( $_POST[ $key . &#38;#39;_wpnonce&#38;#39; ], plugin_basename(__FILE__) ) )
return $post_id;

if ( !current_user_can( &#38;#39;edit_post&#38;#39;, $post_id ))
return $post_id;

foreach ($data as $d =&#38;gt; $v) {
        update_post_meta( $post_id, $d, $v );
    }
}

add_action( &#38;#39;admin_menu&#38;#39;, &#38;#39;create_meta_box&#38;#39; );
add_action( &#38;#39;save_post&#38;#39;, &#38;#39;save_meta_box&#38;#39; );&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Smith on "Custom Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-fields-4#post-44059</link>
			<pubDate>Wed, 14 Dec 2011 19:28:25 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">44059@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi ideaboxx,&#60;/p&#62;
&#60;p&#62;What tutorial did you follow to get this started? That will help in determining who to best assist you from here. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MiikkaMakio on "Drop down dynamic population from single line text"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/drop-down-dynamic-population-from-single-line-text#post-43993</link>
			<pubDate>Wed, 14 Dec 2011 01:55:36 +0000</pubDate>
			<dc:creator>MiikkaMakio</dc:creator>
			<guid isPermaLink="false">43993@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey,&#60;/p&#62;
&#60;p&#62;I've been struggling with the dynamic population thing for some time. Trying to populate a drop down from a single line text -field.&#60;/p&#62;
&#60;p&#62;What would I need to add to get the dynamic population to work for the 'City' drop down?&#60;br /&#62;
If the City that the form user wants to select is not ready in the drop down list, he would be able to write to the 'City if not in the list' and next user of the form would see that one in the 'City' drop down.&#60;br /&#62;
I tried to follow the guide and read bunch of topics many times, but didn't quite get how I should determine that it takes the text from the 'CIty if not in the list' etc.&#60;/p&#62;
&#60;p&#62;FORM: &#60;a href=&#34;http://www.vaihtoon.fi/WordPress/share&#34; rel=&#34;nofollow&#34;&#62;http://www.vaihtoon.fi/WordPress/share&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Help needed, thanks!&#60;/p&#62;
&#60;p&#62;-Miikka
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anonymous on "Custom Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-fields-4#post-43567</link>
			<pubDate>Fri, 09 Dec 2011 16:48:14 +0000</pubDate>
			<dc:creator>Anonymous</dc:creator>
			<guid isPermaLink="false">43567@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have the following custom function code which i'm using to create custom fields for a custom post type.&#60;/p&#62;
&#60;p&#62;The issues is that I need the custom fields to show up individually and at the moment they just show up as 'key' which means that when i try to link a form field (Gravity Forms) to a custom field, I can only link to the 'key' field.&#60;/p&#62;
&#60;p&#62;Can anyone assist with how this can be modified to show each custom field individually so that Gravity Forms can pick up the individual Custom fields?&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;/* Custom Fields */
$key = &#38;quot;key&#38;quot;;
$meta_boxes = array(
&#38;quot;cf_link&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_link&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;URL/Link&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter the URL/Link here.&#38;quot;),
&#38;quot;cf_image&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_image&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;Image&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter the image URL here.&#38;quot;),
&#38;quot;cf_instructions&#38;quot; =&#38;gt; array(
&#38;quot;name&#38;quot; =&#38;gt; &#38;quot;cf_instructions&#38;quot;,
&#38;quot;title&#38;quot; =&#38;gt; &#38;quot;Instructions&#38;quot;,
&#38;quot;type&#38;quot; =&#38;gt; &#38;quot;textarea&#38;quot;,
&#38;quot;description&#38;quot; =&#38;gt; &#38;quot;Enter any specific instructions here.&#38;quot;)
);

function create_meta_box() {
global $key;

if( function_exists( &#38;#39;add_meta_box&#38;#39; ) ) {
add_meta_box( &#38;#39;new-meta-boxes&#38;#39;, ucfirst( $key ) . &#38;#39;Product Details&#38;#39;, &#38;#39;display_meta_box&#38;#39;, &#38;#39;products&#38;#39;, &#38;#39;normal&#38;#39;, &#38;#39;high&#38;#39; );
}
}

function display_meta_box() {
global $post, $meta_boxes, $key;
?&#38;gt;

&#38;lt;div class=&#38;quot;form-wrap&#38;quot;&#38;gt;

&#38;lt;?php
wp_nonce_field( plugin_basename( __FILE__ ), $key . &#38;#39;_wpnonce&#38;#39;, false, true );

foreach($meta_boxes as $meta_box) {
$data = get_post_meta($post-&#38;gt;ID, $key, true);
?&#38;gt;
&#38;lt;div class=&#38;quot;form-field form-required&#38;quot;&#38;gt;
&#38;lt;label for=&#38;quot;&#38;lt;?php echo $meta_box[ &#38;#39;name&#38;#39; ]; ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php echo $meta_box[ &#38;#39;title&#38;#39; ]; ?&#38;gt;&#38;lt;/label&#38;gt;

&#38;lt;?php if( $meta_box[&#38;#39;type&#38;#39;] === &#38;#39;textarea&#38;#39; ) { ?&#38;gt;
  &#38;lt;textarea name=&#38;quot;&#38;lt;?php echo $meta_box[ &#38;#39;name&#38;#39; ];?&#38;gt;&#38;quot; rows=&#38;quot;4&#38;quot;&#38;gt;&#38;lt;?php echo htmlspecialchars($data[$meta_box[&#38;#39;name&#38;#39;]]); ?&#38;gt;&#38;lt;/textarea&#38;gt;
&#38;lt;?php } else { ?&#38;gt;
  &#38;lt;input type=&#38;quot;text&#38;quot; name=&#38;quot;&#38;lt;?php echo $meta_box[&#38;#39;name&#38;#39;]; ?&#38;gt;&#38;quot;
      value=&#38;quot;&#38;lt;?php echo htmlspecialchars( $data[$meta_box[&#38;#39;name&#38;#39;]]); ?&#38;gt;&#38;quot; /&#38;gt;&#38;lt;?php }?&#38;gt;
&#38;lt;p&#38;gt;&#38;lt;?php echo $meta_box[ &#38;#39;description&#38;#39; ]; ?&#38;gt;&#38;lt;/p&#38;gt;
&#38;lt;/div&#38;gt;

&#38;lt;?php } ?&#38;gt;

&#38;lt;/div&#38;gt;
&#38;lt;?php
}

function save_meta_box( $post_id ) {
global $post, $meta_boxes, $key;

foreach( $meta_boxes as $meta_box ) {
$data[ $meta_box[ &#38;#39;name&#38;#39; ] ] = $_POST[ $meta_box[ &#38;#39;name&#38;#39; ] ];
}

if ( !wp_verify_nonce( $_POST[ $key . &#38;#39;_wpnonce&#38;#39; ], plugin_basename(__FILE__) ) )
return $post_id;

if ( !current_user_can( &#38;#39;edit_post&#38;#39;, $post_id ))
return $post_id;

update_post_meta( $post_id, $key, $data );
}

add_action( &#38;#39;admin_menu&#38;#39;, &#38;#39;create_meta_box&#38;#39; );
add_action( &#38;#39;save_post&#38;#39;, &#38;#39;save_meta_box&#38;#39; );&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
