Skip Navigation

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

This support ticket is created 6 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 2 voices.

Last updated by Clifford 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1158885

Can I pass field values / query parameters via CRED's shortcode or its cred_form() PHP function?

I basically want the 'field_values' argument from hidden link but for Toolset Forms

#1158986

The Forms system doesn't offer a way to define field values at the Form shortcode or API invocation level, but you can use your own custom shortcodes in the value attribute of any cred_field shortcode to set a specific value, or you can use the urlparam attribute on a cred_field shortcode to specify a URL parameter that holds the desired value.

[cred_field field="chapter-num" force_type="field" class="form-control" output="bootstrap" value="[your-custom-shortcode]"]

or

[cred_field field="chapter-num" force_type="field" class="form-control" output="bootstrap" urlparam="wpv-chapter-num"]

Documentation for these shortcodes is available here: https://toolset.com/documentation/user-guides/cred-shortcodes/

#1158994

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 include a "go back 2 pages/history" JS button to get 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.

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/pass-field-values-query-parameters-via-cred-shortcode-2/

#1158999

Have you seen the documentation for cred_delete_post_link:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_delete_post_link

I don't fully understand what you're trying to accomplish but it seems this shortcode may be relevant. If it's not appropriate, then I will create the feature request for you.

#1159125

It's not a post that's getting deleted:

...I need a "delete this custom content" on each item in a list.

Please create the feature request.

#1159765

I'm happy to create a feature request, but could you tell me what it is actually deleting instead of what it's not actually deleting? "Custom content" in "a list" of "items" is a bit ambiguous. What is in the list? What exactly is the custom content? Are you trying to delete the contents of several custom fields on a post? Are you trying to delete one instance of a repeating custom field? Are you trying to delete a repeatable field group?

We may be able to come up with a better solution than the redirection / autosubmit / history loop you described, if I understand more about what you want to achieve.

#1159769

We're using Toolset to build a front-end for a multi-vendor WooCommerce Bookings site and each vendor adds their availability rules, such as available 2018-12-05 from 09:00-13:00 and unavailable 2018-12-25 from 12:00-13:00

These rules are within a WooCommerce Product and in a multidimensional array.

Receiving a CRED form with the fields like

site/?content-template-id=1234&bookable=yes&date=2018-12-05&start=09:00&end=13:00

is how I know which array to programmatically delete from the array of availability rules.

The form only has hidden fields with an "X" for the submit button that is alongside each rule.

#1160036

Okay, I've created the feature request and assigned it to Beda, who handles feature requests.

#1160131

tyvm

#1160769

No problem, let me know if there's anything else you need in this ticket.

#1164535