I'm wondering if I can display a CRED_Group conditionally based on either one of two conditions being true. For example, I'm trying to use the following code but it doesn't seem to work.
[cred_show_group if="(($(gen-linkagerequired)+$(gen-searchstatus) eq 2)) or ($(gen-linkagerequired) eq '0' )" mode='fade-slide']
I've also tried using the || operator but that doesn't seem to work either, so I'm wondering if this level of logic can't be handled by Toolset or if I'm just doing something wrong with the syntax. Thanks for any help.
Hi, try it with uppercase "OR" instead. When you use the Conditional Group builder you can find the options "AND" and "OR" to connect multiple conditions - I'm attaching a screenshot here.
Thanks. I feel silly for not noticing that you could add rows of different conditions. That being said, it's mostly working now except that when gen-searchstatus does not have a value it does not seem to work. Gen-linkagerequired will always be 0 or 1, but gen-search status may be 1, 0, or null (under one scenario the option group will not be visible to them so they won't be able to select yes or no).
($(gen-linkagerequired) eq '0' ) OR ($(gen-linkagerequired)+$(gen-searchstatus) eq '2' )
Is there some additional code I can include to make it still function when gen-searchstatus is null?
If gen-searchstatus is null, does the value of gen-linkagerequired matter?
I wouldn't think so, but right now the conditional statement only seems to be working when both gen-linkagerequired=1 and gen-searchstatus=1. When gen-linkagerequired=0 the CRED_Group does not become visible. Can you think of another reason it wouldn't be be showing up? I'll include the full code below:
<div class="form-group">
<label>Type of Item</label>
[cred_generic_field field='gen-linkagerequired' type='radio' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":[],
"options":[
{"value":"1","label":"This is an item that can be bought elsewhere."},
{"value":"0","label":"This is a custom item or a service not currently offered or easily found."}
]
}
[/cred_generic_field]
</div>
[cred_show_group if="($(gen-linkagerequired) eq '1' )" mode='fade-slide']
<div class="form-group">
<label>Link to Item on Be.Education</label>
[cred_generic_field field='gen-searchstatus' type='radio' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":[],
"options":[
{"value":"0","label":"I have not yet searched for this item on Be.Education"},
{"value":"1","label":"I have searched for this item and cannot find it."}
]
}
[/cred_generic_field]
</div>
[cred_show_group if="($(gen-searchstatus) eq '0' )" mode='fade-slide']
<p>Your buy/swap/sell listing will be more successful if you link to an existing product or service on Be.Education. Here's how you do it:</p>
<ol>
<li><a href="/?private-page=products">Search for the product or service.</a></li>
<li>On the product detail page, click the button under the product image to create your buy/swap/sell listing.</li>
</ol>
[/cred_show_group]
[cred_show_group if="($(gen-searchstatus) eq '1' )" mode='fade-slide']
<p>If the item does not currently exist on Be.Education, create your buy/swap/sell listing by filling out the following form and we will take care of the rest!</p>
[/cred_show_group]
[/cred_show_group]
[cred_show_group if="($(gen-linkagerequired) eq '0' )" mode='fade-slide']
<p>Please add your buy/swap/sell listing by completing the following form:</p>
[/cred_show_group]
[cred_show_group if="($(gen-linkagerequired) eq '0' ) OR ($(gen-linkagerequired)+$(gen-searchstatus) eq '2' )" mode='fade-slide']
<div class="form-group">
<label>Headline</label>
[cred_field field='post_title' post='ad' value='' urlparam='' class='form-control' output='bootstrap']
</div>
...
Right now the form does not display if the gen-linkagerequired value gets set to 0.
Okay this is a tricky one, and I'm not able to get it to work unless I have selected something in the hidden field at least once. Let me reach out to my 2nd tier support team for some clarification. It may be a limitation of the CRED conditional engine, or it could be a bug. I will let you know what I find out.
Just a quick update to let you know my 2nd tier team has asked the CRED developer team for some additional information. I will update you when I have additional information to share.
Hi - I'm just checking in on this to see if there's been any movement. Thanks for any updates.
- Aaron
Hi, our developers do not have a permanent solution for this yet but for now they recommend setting a default value of 0 in the second field to select the "I have not yet searched..." radio.
Hi, an update to let you know we plan to include a fix for this in Forms 2.0.1, which is expected to be released very soon. I'll keep you posted here.
That's great - thanks for the update.
Hi, please find Forms 2.0.1 available for download or automatic update and let me know if the issue is not resolved.