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
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/
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.
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.
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.
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.
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.
Okay, I've created the feature request and assigned it to Beda, who handles feature requests.
No problem, let me know if there's anything else you need in this ticket.