Sorry for the delay answer.
I can duplicate the same problem in my localhost with a fresh WordPress installation, and I have checked our to-do list, this is a known issue, see similar thread here:
https://toolset.com/forums/topic/display-conditional-content-on-toolset-forms-is-not-working-with-taxonomy/
I have added this thread into our to-do list, will update here if there is any news.
Currently, you can consider to setup the taxonomy field as single select field, for example:
[cred_field field='listing-category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
then the [cred_show_group] shortcode will be able to work.
I need to use multiselect field so setting up as a single select field will not work for my purposes. And that post you referenced is a year and a half old, so if a simple bug like this is going to go unfixed for 18 months... well I'm disheartened. Actually it seems you guys are working on features for a minority if your use base(Blocks and Layouts) at the moment and letting so many important update and issues like this fall through the cracks. Or am I missing something?
What about the other issue I mentioned? This is actually even more critical as data is being deleted due to the cred_show_group functionality:
"Also the other issue I mentioned previously still occurs, if a non Spa category is selected and the form is saved. Then a Spa category is selected and the for is saved again the fields that were previously saved in those custom fields are gone. It's as if the cred_show_group when it hides then shows clears out checkboxes fields."
Tim
For the question:
if the Spa category is deselected from from the Edit form, and then re-selected, the checkbox selections within that hidden area get cleared out, the data is lost.
I have tried it in my localhost with a fresh WordPress installation:
If I select the speicifc option "SPA", enable some options in the checkboxes field, and deselect that option, it works fine, I can the options in options in the checkboxes field are selected.
Then I checked it in your website, it seems that you have already changed the form settings, I don't see any checkboxes insider [cred_show_group] ... [/cred_show_group].
I assume we are talking about this:
Select the option "SPA", enable some options in the checkboxes field "style-of-spa-or-massage-business", and deselect "SPA" option, it will disable the checkboxes field within by adding "disabled" attributes to those checkboxes, you can check inspect the element attribute with Chrome browser, so when you submit the post form, it won't submit checkboxes field "style-of-spa-or-massage-business" data, so it is expected result:
the checkboxes field "style-of-spa-or-massage-business" are gone.
Please confirm it is the same issue as you mentioned above, thanks
More help:
hidden link
I think there might be some confusion, but I'm not sure, I will make a screencast to show the issue more clearly:
hidden link
If that is an expected result then there is a serious problem, would that really be the behavior you expect? You switch one field/taxonomy and other fields are completely cleared from the database? No way.
Also I'd really like to know why after 18+ months the first issue is still unresolved. It's important I know what is prioritized to know if I need to find other plugin solutions.
Tim
Thanks for the video, that is the same issue, if you deselect those "spa" term, those hidden checkboxes fields "spa & massage details" will be disabled, and disabled form element won't be submitted, so it is expected result.
See the document I mentioned above:
hidden link
Tip: Disabled <input> elements in a form will not be submitted!
For the question:
Also I'd really like to know why after 18+ months the first issue is still unresolved.
By default, when you add conditional group into Toolset forms, there isn't any option to use taxonomy field, see screenshot: field.JPG
And it is still in our to-do list, I am not sure when will it be fixed.
In your case, you can consider custom JS codes, for example, I have done below modifications in your website:
1) Edit the post form "TEST form for toolset - delete when done", in section "JS Editor", add below JS codes:
jQuery(document).on('cred_form_ready', function(){
jQuery("select[name='listing-category[]']").change(function () {
my_func();
});
my_func();
});
function my_func(){
if (
(jQuery('option[value="313"]:checked').length == 1)
|| (jQuery('option[value="314"]:checked').length == 1)
|| (jQuery('option[value="315"]:checked').length == 1)
|| (jQuery('option[value="316"]:checked').length == 1)
|| (jQuery('option[value="317"]:checked').length == 1)
|| (jQuery('option[value="318"]:checked').length == 1)
) {
jQuery('.my-condtion-div').show();
}
else{
jQuery('.my-condtion-div').hide();
}
}
2) disable the [cred_show_group] ... [/cred_show_group] shortcodes
Test it in front-end:
hidden link
It should work as you expected.
You can change the show() and hide() options by following jquery document:
hidden link
Thank you for the js code.
But I'm still confused with the idea of "disabled". You said once disabled then they are not submitted. If they are not submitted then how can their values be cleared out? This doesn't really make sense.
I really just want to show/hide these elements as normal toggles work. I think most people would assume the "cred_show_group" functions like a toggle switch. If not is there anyway to have it work like that?
Tim
Q1) If they are not submitted then how can their values be cleared out? This doesn't really make sense.
I can duplicated the same problem when use custom checkboxes field "spa & massage details" insider shortcode [cred_show_group] ... [/cred_show_group], but there isn't the same issue for other field types, for example single linge field radio field.
Can you confirm it? The custom checkboxes field is a specicial field type of Toolset plugins, it might be designed as that.
Q2) If not is there anyway to have it work like that?
No, [cred_show_group] shortcode works as I mentioned above:
if you deselect those "spa" term, those hidden checkboxes fields "spa & massage details" will be disabled, and disabled form element won't be submitted
You might consider other JS workaround, see the example I provided above:
https://toolset.com/forums/topic/edit-form-cred_show_group-not-working-for-multiple-categories/page/2/#post-1579303
Yes, I can confirm. It seems only the custom checkbox fields get cleared/deleted. Other fields do not. So it would seem this is a bug right? No field should get deleted.
Thanks for the confirmation, escalated and will update here if there is any news.
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Luo is on Vacation. This is Minesh here and I'll take care of this ticket now.
Yes, I can confirm. It seems only the custom checkbox fields get cleared/deleted. Other fields do not. So it would seem this is a bug right? No field should get deleted.
==>
The issue is known to us and our Devs shared the following errata page for that. Our Devs will try their best to fix the issue.
- https://toolset.com/errata/toolset-forms-deletes-image-postmeta-if-field-is-conditionally-hidden-in-the-form-even-if-the-field-has-a-value-saved/
Do you have any workaround to save the field? Let me know if you require a workaround to save the field value.
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I would like to also update you about conditional statement with your multiple select fields which is not working as expected and that is also known to us. We already escalated the issue in front of our Devs and I will get in touch with you when I get any updates on that.
For now, you may would like to go with the workaround shared by the Luo with the following reply:
=> https://toolset.com/forums/topic/edit-form-cred_show_group-not-working-for-multiple-categories/page/2/#post-1579303
Thanks for that js workaround but it seems it does not work if multiple categories are selected. When I look at the code those || Or statements should allow multiple category selections to still activate "show"... hmmmm,
[php]
(jQuery('option[value="313"]:checked').length == 1)
|| (jQuery('option[value="314"]:checked').length == 1)
|| (jQuery('option[value="315"]:checked').length == 1)
|| (jQuery('option[value="316"]:checked').length == 1)
|| (jQuery('option[value="317"]:checked').length == 1)
|| (jQuery('option[value="318"]:checked').length == 1)
)
</cod>
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I'm not sure where its not working. On this page: hidden link
The following form is used:
=> hidden link
Where I've added the workaround code-shared by Luo.
And I I select multiple categories from the multi-select dropdown for the "Spa and Massage" I can see the div and if I select only "Spanish" I can see the section is not displayed.
hmmm, I was referring to the test page, not sure why it wasn't working there. But if it's working on the page you referenced that's better. Thanks!