Can we talk about adding fields?

Hi–

I’ve been working to add fields dynamically to my form and think it’s working, but I have questions.

Just as a proof of concept, I’m adding a basic text field following the code on this page: How to Add a New Field to an Existing Form Using the GFAPI

So, the field only appears after I reload the page. Is this right? Is there a way to make the field appear without reloading?

I’m also noticing how the field is there after restarting the browser. So, when I add the field to the form, is that field now fully a part of the form for all users or just the current user?

Ideally, I’d like to add fields for the current user only and without having to reload the page. is this possible?

Thank you!

/kevin

That doc outlines adding a field to the stored form object. If you would like to dynamically add a field to a form as it is rendered, you’ll need to use a filter like gform_form_post_get_meta and insert to the fields property. See documentation for the Repeater (beta) which outlines one use case for that filter. It also demonstrates usage of gform_form_update_meta to ensure the changes do not get saved to the form object.