Hi, I've an edit Toolset Post form where I want to display some field conditionally by taxonomy terms of a custom taxonomy.
I found your GUI doesn't offer the option to select Taxonomy on conditional display, but I found this on your forum;
https://toolset.com/forums/topic/conditional-fields-in-form-based-on-selected-taxonomy-2/#post-627674
So I set up this code:
[cred_field field='stall-category' force_type='taxonomy' output='bootstrap' display='checkbox']
[cred_field field="stall-category_add_new" taxonomy="stall-category" type="add_new"]
[cred_show_group if="( $(stall-category) eq '2' ) OR ( $(stall-category) eq '3' )" mode="fade-slide"]
<div class="food-stalls">
...
</div>
[/cred_show_group]
This is the form output:
<div class="js-wpt-field-items js-wpt-repetitive wpt-repetitive" data-initial-conditional="" data-item_name="taxonomyhierarchical-stall-category">
<ul class="wpt-form-set wpt-form-set-checkboxes wpt-form-set-checkboxes-stall-category" data-level="0">
<li class="checkbox tax-bakery tax-stall-category-6"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_38_3-checkbox-2-1540412165">
<input type="checkbox" id="cred_form_38_3-checkbox-2-1540412165" name="stall-category[]" data-wpt-type="checkbox" data-wpt-id="cred_form_38_3_cred_form_38_3-checkbox-2-1540412165" data-wpt-name="stall-category[]" value="6" data-parent="-1" data-value="Bakery" class="wpt-form-checkbox form-checkbox checkbox">
Bakery</label></li>
<li class="tax-children-of-6"><ul class="wpt-form-set-children wpt-form-set-children-level-1" data-level="1"><li class="checkbox tax-bread tax-stall-category-19"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_38_3-checkbox-3-1540412165">
<input type="checkbox" id="cred_form_38_3-checkbox-3-1540412165" name="stall-category[]" data-wpt-type="checkbox" data-wpt-id="cred_form_38_3_cred_form_38_3-checkbox-3-1540412165" data-wpt-name="stall-category[]" value="19" data-parent="6" data-value="Bread" class="wpt-form-checkbox form-checkbox checkbox">
Bread</label></li>
<li class="checkbox tax-fruit-and-vegetables tax-stall-category-2"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_38_3-checkbox-10-1540412165">
<input type="checkbox" id="cred_form_38_3-checkbox-10-1540412165" name="stall-category[]" data-wpt-type="checkbox" data-wpt-id="cred_form_38_3_cred_form_38_3-checkbox-10-1540412165" data-wpt-name="stall-category[]" value="2" data-parent="-1" data-value="Fruit and vegetables" class="wpt-form-checkbox form-checkbox checkbox">
Fruit and vegetables</label></li>
<li class="checkbox tax-meat tax-stall-category-3"><label class="wpt-form-label wpt-form-checkbox-label" for="cred_form_38_3-checkbox-15-1540412165">
<input type="checkbox" id="cred_form_38_3-checkbox-15-1540412165" name="stall-category[]" data-wpt-type="checkbox" data-wpt-id="cred_form_38_3_cred_form_38_3-checkbox-15-1540412165" data-wpt-name="stall-category[]" value="3" data-parent="-1" data-value="Meat" class="wpt-form-checkbox form-checkbox checkbox">
Meat</label></li>
<input type="hidden" id="cred_form_38_3-hidden-1-1540412165" name="stall-category_hierarchy" value="" class="wpt-form-hidden form-hidden" data-wpt-id="cred_form_38_3_cred_form_38_3-hidden-1-1540412165" data-wpt-name="stall-category_hierarchy"></div>
<div class="cred-group 38_condition_1 wpt-conditional-hidden js-wpt-remove-on-submit js-wpt-validation-ignore" style="display:none;" data-effectmode="fade-slide">
<div class="food-stalls">
...
</div>
</div>
The .food-stalls block is hidden, but I cannot display it on selecting "stall-category-2" or "stall-category-3" taxonomy terms.
can you help me?
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Well - It looks like you need to set your taxonomy to display as select drop-down box then you can use it with the CRED Forms conditional statement.
What if you try to display your taxonomy field as given under and try to resolve your issue:
[cred_field field='stall-category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
Hi Minesh, the problem is that I need multiselection and I also have sub-categories, so I need to display checkboxes.
Any suggestion how can I solve this? Any jQuery?
thanks
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Could you please share the problem URL where you added the form - let me check if there is solution.
Hi, this is the form:
/wp-admin/post.php?post=38&action=edit
Here it is on frontend (use the login credentials):
/trader-profile/
You have to select "Stall details & documents" tab to check the form output.
cheers
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Well - I checked and when you set your taxonomy field to display as checkbox there is an issue currently and its known to us which is set to fix with the Toolset Forms release version 2.2 in near future.
For now, the only option is the convert your taxonomy field display to select instead of checkbox.
Ok, can you tell me more or less when will you publish 2.2 relese? Just to understand if I can wait for it or look for another solution.
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Unfortunately, I do not have any ETA on it as the work on this issue is unscheduled yet. Maybe you can expect it within a couple of months from now but again no promise as its totally depends upon our Devs predefined priorities and available resources.
The ETA takes too long for me, I need a multi-select category, so conditional doesn't work for me. I will look for a different setup.
cheers