Hi,
I want to create a post submit form for specific taxonomy in my cpt, how can I do that?
Hello,
You can try below one of below two options:
1) specific the default value of taxonomy field, and hide it with some CSS codes
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
Argument "value": Preset value
2) no taxonomy field in the post form, after user submit the form, use CRED action hook "cred_save_data" to setup the taxonomy value
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Hi,
i sow the two options you add, i not geting the checkbox of the taxonomy to be checked.
this is the field in the cred form: [cred_field field='bc_des' display='checkbox' value='2' output='bootstrap']
what ami i doing wrong?
BR
Ronen
Hi, i try also this:
jQuery(document).ready(function($) {
jQuery("select[name^='YOUR-SELECT-NAME'] option[value='OPTION-VALUE']").attr("selected","selected");
});
but the after i save thr form it show: $(document).ready(function($) {
$(\"select[name^=\'bc_des\'] option[value=\'לבן\']\").attr(\"selected\",\"selected\");
});
it adds an \ to the code and the code not workind how to fix it?
You are right the value attribute only work for custom field, it does not work for custom taxonomy.
And the JS codes of form does not saved correctly, it adds slash “\” before single quote and double quotes, I have escalated this issue, our developers will take care it.
Currently, I suggest you try to put the JS codes into a content template, use the content template to display the Toolset form shortcode [cred_form form="..."]
The custom JS codes will be able to be saved correctly in the content template.
Also you can still use the option 2) I mentioned above:
https://toolset.com/forums/topic/cred-form-for-specific-taxonomy/#post-951198
Please let me know if you need assistance to use the action hook "cred_save_data"
Our developers has provided a hot-fix the JS codes issue here:
https://toolset.com/errata/quotes-in-the-extra-css-or-js-content-will-get-backslashed/
Please test it and feedback if it is fixed, thanks
Thank you very much for your help...