Hi,
thank you for your answer. Before I try to do that on my own, I have a simmilar question.
I made a conditional group in a form, where the user have to choose from a dropdown with parent informations. The parent (company) from the owner is shown. I try to show the group, if the user selected his company.
[cred_show_group if=“ ($ (job-company.parent) ??????? “ mode=„fade-slide“]
[/cred_show_group]
What do I have to fill instead of the ??????? to get this check if it not empty? I read the documentation and try it with some of the booleans like !EMPTY, but nothing is working.
Thank you for helping me to understand toolset a little bit better.
Hello.
You can test if the value of field is different than an empty string.
[cred_show_group if="( $(job-company.parent) ne '' )" mode="fade-slide"]
[/cred_show_group]
I hope this helps. Let me know what you will get.
Hello,
I tried it but no reaction.
By the way, I made a little mistake. It has to be : company-job.parent
Hello Jamal,
to make my previous reply clear, it is still not working.
If you have a bunch of ideas, I'll try them all 🙂
Heiko
My apologies for the late reply, but I do not work on Sundays and Mondays.
I created a test site and a 1-to-many relationship between CPTs "Company" and "Jobs", and it turns out, that we can't have conditional display of fields based on relationships, it is only possible with custom fields and taxonomy terms. That is also documented here https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/
I am really sorry, I did not check this for the first time.
The workaround that remains, is to use custom Javascript code to show/hide a section based on the value of the relationship field in the form. I created an example where we hide the submit button until a parent has been entered with the following Javascript code:
jQuery(function($){
var select = $('select[name="@company-job.parent"]');
var form = select.closest('form');
var submit = form.find('input[type=submit]');
if (select.val() == '') submit.hide();
select.on('change',function(){
if (select.val() == '') submit.hide();
else submit.show();
})
})
You can check my example on the following site hidden link
I hope this helps. Let me know if you have any questions.
Hi Jamal,
my last reply was only to prevent a misunderstanding of the previous reply. I know your work days.
Thank you for the snippet. I‘ll try it the next days and come back to you.
Have a nice day!
Thank you for your feedback.
I'll set the ticket as waiting for your reply, it should be kept open for 3 weeks.
Have a nice day as well 🙂
My issue is resolved now. Thank you!