<?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: Option/function to return a more complex form data structure</title>
		<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure</link>
		<description>Gravity Support Forums Topic: Option/function to return a more complex form data structure</description>
		<language>en-US</language>
		<pubDate>Sun, 05 Apr 2026 16:20:44 +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/optionfunction-to-return-a-more-complex-form-data-structure" rel="self" type="application/rss+xml" />

		<item>
			<title>dnb on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-47184</link>
			<pubDate>Tue, 24 Jan 2012 01:12:34 +0000</pubDate>
			<dc:creator>dnb</dc:creator>
			<guid isPermaLink="false">47184@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Alex-&#60;br /&#62;
  Sorry for being so slow to respond to your reply (didn't get an email notification). Let me see if I can answer your questions:&#60;/p&#62;
&#60;p&#62;1) backward compatibility but providing a non-flat entry object when requested - I appreciate that you are trying to preserve this:&#60;/p&#62;
&#60;p&#62;There are a number of ways to handle this. A few ideas:&#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;Some APIs (like the old LDAP C SDK) provide additional calls that return extended versions of an object, so you could have explicit hooks that did it (&#34;gform_after_submission_ex()&#34;).&#60;/li&#62;
&#60;li&#62;Some have you pass a flag into the call to request the enhanced version.&#60;/li&#62;
&#60;li&#62;Some provide helper methods (get_all_values_ex()) that you can call on/from the object.&#60;/li&#62;
&#60;li&#62;Some sort of global flag (my least favorite idea, where you say $GF::ObjectVersion = 2). &#60;/li&#62;
&#60;/ul&#62;
&#60;p&#62;2) where to get the field name if indexing by field names: I'm suggesting you get it from the 'label' (or 'adminLabel' if set) form field value.&#60;/p&#62;
&#60;p&#62;... or, see my post about a library of helper functions. A helper function that takes in a flat entry object but returns one that is easier to work with would also be viable (albeit a bit of a performance hit). You could imagine something like:&#60;/p&#62;
&#60;p&#62;   $better_entry = make_nice_entry($entry); # bad name, I know&#60;br /&#62;
   $better_entry['colorcheckbox'] would now be a list ('red', 'blue') based on the form choice.&#60;/p&#62;
&#60;p&#62;In regard to Ben's response: Ben, could you post a snippet of code? I'm not sure I understand what you are suggesting and why having an entry object that was easier to work with would be a bad thing if backward compatibility could exist for some number of versions.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-46630</link>
			<pubDate>Tue, 17 Jan 2012 19:10:44 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">46630@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks for your thoughts Ben.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Ben on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-46224</link>
			<pubDate>Thu, 12 Jan 2012 11:34:35 +0000</pubDate>
			<dc:creator>Ben</dc:creator>
			<guid isPermaLink="false">46224@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I found it easier to do by using the form object and adding code to flip through the entry object when it comes across a checkbox field. It's easy enough that I would think it would be a waste of time and too much trouble for backward compatibility to change the actual entry object.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-45919</link>
			<pubDate>Mon, 09 Jan 2012 20:04:06 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">45919@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Uh oh! Busted.&#60;/p&#62;
&#60;p&#62;These are some good ideas and I do agree that these changes would make the entry object easier to use. My question is how do we make it backwards compatible? Lots of people are already relying on the entry object in this format. Also, where would you get the field name from to use it as an index?&#60;br /&#62;
Thanks for the suggestions.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dnb on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-45842</link>
			<pubDate>Mon, 09 Jan 2012 02:07:20 +0000</pubDate>
			<dc:creator>dnb</dc:creator>
			<guid isPermaLink="false">45842@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Super, thanks!&#60;br /&#62;
       -- dNb&#60;/p&#62;
&#60;p&#62;P.S. There's no rush (I know one of them is sunning himself as we speak).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-45841</link>
			<pubDate>Mon, 09 Jan 2012 02:05:52 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">45841@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I forwarded this topic to one of the developers to see if we can get some feedback for you.  Thanks for your patience.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dnb on "Option/function to return a more complex form data structure"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/optionfunction-to-return-a-more-complex-form-data-structure#post-45788</link>
			<pubDate>Sat, 07 Jan 2012 20:21:12 +0000</pubDate>
			<dc:creator>dnb</dc:creator>
			<guid isPermaLink="false">45788@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi-&#60;br /&#62;
This is related to my post &#60;a href=&#34;http://www.gravityhelp.com/forums/topic/helper-functions&#34; rel=&#34;nofollow&#34;&#62;here&#60;/a&#62; about helper functions for GF. On a recent project, I needed to use the entry object returned by gform_after_submission() to retrieve all of the responses in a checkbox field. As far as I know, the only way to do this is to do a linear walk over the keys in the entry object, doing a string match for the ID of that field as a prefix (i.e. if the field ID is 3, you look for 3.1, 3.2, 3.3, etc.).&#60;/p&#62;
&#60;p&#62;It would be really great if there was a way to get back an entry object that wasn't just a flat array. Using the example above, something like:&#60;/p&#62;
&#60;p&#62; &#60;code&#62;$entry[3] = [ {3.1&#38;#39;s value},  {3.2&#38;#39;s value},  ... {3.x&#38;#39;s value} ];&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;would be awfully spiffy and make the retrieval of all of the values returned from a multi-valued field much easier. &#60;/p&#62;
&#60;p&#62;If you want to get really fancy, it would also be great if fields could also be referenced by name, so that one could do:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$entry[&#38;#39;checkbox_field_name&#38;#39;] = [{value1}, {value2}, {value3}...{valueX}] ;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If there were two fields with the same name, you would suffix the name with the field ID, as in:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$entry[&#38;#39;checkbox_field_name_3&#38;#39;] = [ {value1}, {value2}, {value3} ... ] ;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;The rationale for this request is code that says:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$entry[&#38;#39;checkbox_field_name&#38;#39;]&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;is much easier to grok than:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$entry[&#38;#39;3&#38;#39;]&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;It also seems a little less fragile to me, since if that field is no longer #3 for some reason, the code doesn't break.&#60;/p&#62;
&#60;p&#62;Thanks for considering this idea!&#60;/p&#62;
&#60;p&#62;     -- dNb
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
