Populate super form fields with custom post meta values #56
-
Hi, Basically, I need to populate super form fields with custom post meta values when the form is loaded. My application sends only post_id ($GET) to the page where contains the super form. The rest information for the form fields should be retrieved from php functions using the post_id. Of course, I've looked into the tag system like {post_meta****}, but it works only on the current post (which is the page that embeds the super forms), not on a custom post type. I've spent days analysing the source code but couldn't figure out the right filters or ways to populate form fields using custom post data. I've tried ALL of the filters (https://renstillmann.github.io/super-forms/#/filter-hooks) but could not find a solution. This filter ( Is there a filter that can be applied when populating values to text and other fields? If not, could you guide me on how to do that, please? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, "but it works only on the current post (which is the page that embeds the super forms), not on a custom post type." I don't think the above is true, you should be able to retrieve meta data with that tag from any post type. In the end, a custom post type is still a "post". So you should be able to use There is no filter hook at the moment to directly change the default value of a field. You might/could create a custom shortcode function and set the shortcode inside the default value, but I don't know if that will work, but it might work. |
Beta Was this translation helpful? Give feedback.
Hi,
"but it works only on the current post (which is the page that embeds the super forms), not on a custom post type."
I don't think the above is true, you should be able to retrieve meta data with that tag from any post type. In the end, a custom post type is still a "post". So you should be able to use
{post_meta_*****}
tag to retrieve any custom post meta data from the current post the form is on.There is no filter hook at the moment to directly change the default value of a field.
You might/could create a custom shortcode function and set the shortcode inside the default value, but I don't know if that will work, but it might work.