Hi Chris,
I have found out that checkbox items added dynamically on "gform_pre_render" / "gform_admin_pre_render" are not available to functions added to form submission hooks (such as "gform_validation", "gform_pre_submission" etc), unless the form is saved in the GF admin area after dynamic population.
When pure arbitrary data is used to pre-render the checkboxes, the above workaround is not possible.
Therefore I use the following approach which seems to work very well for me: on "gform_pre_render" I use RGFormsModel::get_form_meta() method to fetch the form from database, then populate the form controls as required, and then the form is saved back to the database using RGFormsModel::update_form_meta(). This behaviour can be controlled using a boolean constant, as shown below:
Using this approach you can view the checkbox values in the entry list as well as change the entry, by updating the submitted checkbox values.
Hope this helps.
Posted 12 years ago on Monday September 17, 2012 |
Permalink