Edit a form with tags and categories (again)

Hi there,

I am trying to set up an edit function on my site for a custom post type with tags and a category.

I understood that you can pass the values in the URL, but that you cannot “preload” an Entity by ID passed by a GET parameter to map the values of the fields with the loaded Entity. This was my first BIG disappointment. Seems weird, as obviously, you will not pass a full content through a GET parameter…

So, I tried to code it. But the docs are not very clear despite there are many questions about it in various places.

I am using gform_pre_render hook, after trying gform_field_value. My questions is:

  • How to set-up select and multiselect fields with a value?
  • Why is there absolutely nothing about that in the docs? Setting the default values of all supported fields should be a basic feature for a form solution!

What I have tried:

  • In gform_pre_render, setting defaultValue works for input text field, not for dropdowns.
  • I read in some posts that isSelected should be used, but it does not seem to work anymore

So what is exactly expected to select the value of various fields in a) gform_pre_render b) gform_field_value ???

Thanks a lot.

The following is a full working tutorial on how to pre-populate a drop down field: Dynamically Populating Drop Down, Radio Buttons or Multi-Select Fields - Gravity Forms

The same approach can be used for radio button or multi-select fields.

I would recommend you to try the above example first, to see how it works. Then use it as a base for your use case.

If you can’t get your version to work, I would recommend you to enable logging and add custom logging statements to your code to debug it.

The gform_pre_render documentation has also another example for drop down, radio and multi-select (the first one), and an additional example for checkboxes: gform_pre_render - Gravity Forms Documentation

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.