Skip Navigation

[Resolved] Pass field values / query parameters via CRED Shortcode

This thread is resolved. Here is a description of the problem and solution.

Problem:
I want to suggest a new feature for Toolset. Where and how can I do that? How to add my voice to the request(s) discussed in the below thread?

Solution:
You can suggest, and upvote (add your voice to, request as well) new features for Toolset here:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Toolset's Product Management receives a notification and accordingly evaluates and plans features for Toolset.

100% of people find this useful.

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 replies, has 2 voices.

Last updated by Clifford 5 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#1160035

Please add a feature request for passing field values to the [cred_form] shortcode. I would like to be able to set field values at the Form shortcode level, or with the PHP cred_form function, like I can with Gravity Forms.

#1160533

You can set fields values by passing the urlparam attribute to Fields in Forms, but you cannot pass a field value within the Toolset Form ShortCode itself.

Usually, it is enough to use the urlparam attribute in each field in each form.
Would that help you?

If not, please let me know in case the request you had is still required, and if you could, a usage scenario where this would be more helpful than setting it in the URL.

The usage of urlparam is elaborated here:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field > urlparam

#1161316

Copying from my other thread that got split into this thread:

URL query parameter is only way forward for me at this time, since I need a "delete this custom content" on each item in a list.

So I have to create a new content template, add JavaScript to it to auto-submit the form upon arrival, ensure the form is set to Ajax else infinite redirect/re-submit loop, build a link with the appropriate parameters, then redirect them back to where they were.

This would be simplified considerably if I could have the form set to Ajax and each list item's "delete" button (form submission button) and the page user is on would reload.

Please add a feature request for passing field_values to [cred_form], like I can with Gravity Forms' shortcode: hidden link

#1161462

Thanks, but as Christian already stated here, https://toolset.com/forums/topic/pass-field-values-query-parameters-via-cred-shortcode/#post-1158999 - it is not clear what that means or how this connects to the request, which is possible to achieve in granulated control over each field in the form

What you describe later https://toolset.com/forums/topic/pass-field-values-query-parameters-via-cred-shortcode/#post-1159769 is exactly what this does.
It sets values for each of the URL params for each of the fields you pass the param to.

Of course, you need to create that link (URL) manually, there is no way around that.
If you have those attributes in the Form ShortCode it won't really help because they will be just doing the same as if you do it manually, namely, create the URL and link to it.
Values in the ShortCode attributes of a Forms ShortCode could not be any more dynamic than the URL params you set in the Forms Fields ShortCodes, or any less.

On the contrary, since you neede to actually tell the Form Field what URL param to listen to, you need to edit it!
Otherwise, you are not able to pass the right value coming from the URL to it, as the field simply won't listen to this.

I understand that you would like to have a Field "My Field" in the Form, and then, when you insert either Edit Link, Form or Create Form, to pass the value for that field in the very Forms ShortCode, like [cred_form form="form" field_value_for_my_field="anything" field_value_for_my_other_field="anything"] etc.

I can file that as a request, but this will likely not be implemented anytime soon as it requires a whole new set of features, GUI and tests, for this to work, additionally, we would enter it conflicts with the existing URL param (what has prevalence?)

If you have thoughts and inputs on that conflict risk please share them so I can input them to the request as well.

#1164536

I don't see how this request is any different than https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_form being able to take the Post ID:

[cred_form form="Edit Car" post="145"]

I just want something like

[cred_form form="Edit Car" post="145" field_values="new_status=approved&date_start=20181225&whatever_else=xYz123"]

I'd imagine the "field_values" argument would act like the "post" argument.

#1164707

I understand the request better now, thanks

I thought you want one attribute each field, but the way shown is asking for less GUI updates and a possible implementation can be done.

I filed the request here:
https://toolset.com/feature-request/allow-to-pass-values-to-custom-fields-in-a-form-by-form-shortcode-attribute/
You can upvote it here:
https://toolset.com/feature-request/?wpv_post_search=Allow+to+pass+values+to+Custom+Fields+in+a+Form+by+Form+ShortCode+attribute&wpv-wpcf-plugins=Forms&wpv_sort_orderby=post_date&wpv_sort_orderby_as=string&wpv_view_count=686737

#1166836

thank you