Hi-
This is related to my post here 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.).
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:
$entry[3] = [ {3.1's value}, {3.2's value}, ... {3.x's value} ];
would be awfully spiffy and make the retrieval of all of the values returned from a multi-valued field much easier.
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:
$entry['checkbox_field_name'] = [{value1}, {value2}, {value3}...{valueX}] ;
If there were two fields with the same name, you would suffix the name with the field ID, as in:
$entry['checkbox_field_name_3'] = [ {value1}, {value2}, {value3} ... ] ;
The rationale for this request is code that says:
$entry['checkbox_field_name']
is much easier to grok than:
$entry['3']
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.
Thanks for considering this idea!
-- dNb