Skip Navigation

[Resolved] Conditional group

This thread is resolved. Here is a description of the problem and solution.

Problem: CRED conditional group not working.

Solution: There was issue with HTML structure with CRED conditional display. You need to use

tag inside the conditional group statement.

You can find proposed solution with the following reply: https://toolset.com/forums/topic/conditional-group/#post-416563

Relevant Documentation: => https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/ => https://toolset.com/documentation/user-guides/cred-conditional-display-engine/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 7 replies, has 2 voices.

Last updated by kennethy 5 years, 2 months ago.

Assigned support staff: Minesh.

Author
Posts
#413186

What's wrong with this?

The form description does not appear when "yes" value 2 is selected.

[credform class='cred-form cred-keep-original']

[cred_field field='form_messages' value='']

<div class="cred-field cred-field-post_title">
<label class="cred-label">
Form Name
</label>
[cred_field field='post_title' post='form' value='' urlparam='']
</div>

<div class="cred-field cred-field-post_content">
<label class="cred-label">

[cred_generic_field field='select-requirements' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":["2"],
"options":[{"value":"1","label":"yes"},{"value":"2","label":"no"}]
}
[/cred_generic_field]

[cred_show_group if="($(select-requirements) eq '1' )" mode='fade-slide']
Form Description
</label>
[cred_field field='post_content' post='form' value='' urlparam='']
</div>

[cred_field field='form_submit' value='Submit' urlparam='']
[/cred_show_group]

[/credform]

#413268

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I've tested the code with my local test install nad its working fine at this end.

Could you please try to resolve your issue by deactivating all third-party plugins as well as with the default theme to check for any possible conflicts with any of the plugins or themes?

#416364

Hi have removed the plugin. its works can help me check if this work on your side?
Thank you

[credform class='cred-form cred-keep-original']
<table>
<tr>
<td>
<div class="form-subject"> Name: </div>
</td>
<td>
[cred_generic_field field='name' type='textfield' class='short-textfield' urlparam='']
{
"required":1,
"validate_format":1,
"default":"your name"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>
<div class="form-subject">Company Name: </div>
</td>
<td>
[cred_generic_field field='company' type='textfield' urlparam='']
{
"required":0,
"validate_format":0,
"default":"your company"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject"> Email: </div>
</td>
<td>
[cred_generic_field field='email' type='email' urlparam='']
{
"required":1,
"validate_format":1,
"default":"your email"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>
<div class="form-subject">Contact no: </div>
</td>
<td>
[cred_generic_field field='contact' type='phone' urlparam='']
{
"required":0,
"validate_format":0,
"default":"your telephone number"
}
[/cred_generic_field]
</td>
</tr>

</table>

<div id="sel-req">
[cred_generic_field field='select-requirements' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":["1"],
"options":[
{"value":"1","label":"No"},
{"value":"2","label":"Yes"}]
}
[/cred_generic_field]
</div>
<div class="form-subject">, I would like to share my requirements. </div>

<table>

[cred_show_group if="($(select-requirements) eq '2' )" mode='fade-slide']
<tr>
<td class="form-align">

<div class="form-subject">Estimated prefer date of possession</div>
</td>
<td>
[cred_generic_field field='form-req-Possession-date' type='date' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>

<tr>
<td>
<div class="form-subject">End date of current lease </div>
</td>
<td>
[cred_generic_field field='endlease' type='date' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject">Number of people in the office </div>
</td>
<td>
[cred_generic_field field='headcount' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td colspan="2">
<div class="form-subject">Size required:</div>

[cred_generic_field field='sizefrom' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field] <div class="form-subject"> to </div>

[cred_generic_field field='sizeto' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

[cred_generic_field field='form-units' type='checkboxes' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":["1"],
"options":[
{"value":"1","label":"sqft"},
{"value":"2","label":"sqm"}
]
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject">Budget: $</div>

[cred_generic_field field='budgetpsf' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

<div class="form-subject">psf </div>
</td>
<td>
<div class="form-subject">Rental $</div>
[cred_generic_field field='budgetquantum' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

<div class="form-subject">per month</div>
</td>
</tr>
[/cred_show_group]

<tr>
<td colspan="2">

<div class="commentenquiry"> Comments / Enquiry:</div>
[cred_generic_field field='commentenquiry' type='textarea' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":"Tell me..."
}
[/cred_generic_field]
</td>
</tr>
</table>

[/credform]

#416563

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I found the issue. You need to use <table> tag inside the conditional group statement.

Could you please use following code and try to resolve your issue.

[credform class='cred-form cred-keep-original']
<table>
<tr>
<td>
<div class="form-subject"> Name: </div>
</td>
<td>
[cred_generic_field field='name' type='textfield' class='short-textfield' urlparam='']
{
"required":1,
"validate_format":1,
"default":"your name"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>
<div class="form-subject">Company Name: </div>
</td>
<td>
[cred_generic_field field='company' type='textfield' urlparam='']
{
"required":0,
"validate_format":0,
"default":"your company"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject"> Email: </div>
</td>
<td>
[cred_generic_field field='email' type='email' urlparam='']
{
"required":1,
"validate_format":1,
"default":"your email"
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>
<div class="form-subject">Contact no: </div>
</td>
<td>
[cred_generic_field field='contact' type='phone' urlparam='']
{
"required":0,
"validate_format":0,
"default":"your telephone number"
}
[/cred_generic_field]
</td>
</tr>

</table>

<div id="sel-req">
[cred_generic_field field='select-requirements' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":["1"],
"options":[
{"value":"1","label":"No"},
{"value":"2","label":"Yes"}]
}
[/cred_generic_field]
</div>
<div class="form-subject">, I would like to share my requirements. </div>

[cred_show_group if="($(select-requirements) eq '2' )" mode='fade-slide']
<table>
<tr>
<td class="form-align">

<div class="form-subject">Estimated prefer date of possession</div>
</td>
<td>
[cred_generic_field field='form-req-Possession-date' type='date' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>

<tr>
<td>
<div class="form-subject">End date of current lease </div>
</td>
<td>
[cred_generic_field field='endlease' type='date' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject">Number of people in the office </div>
</td>
<td>
[cred_generic_field field='headcount' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td colspan="2">
<div class="form-subject">Size required:</div>

[cred_generic_field field='sizefrom' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field] <div class="form-subject"> to </div>

[cred_generic_field field='sizeto' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

[cred_generic_field field='form-units' type='checkboxes' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":["1"],
"options":[
{"value":"1","label":"sqft"},
{"value":"2","label":"sqm"}
]
}
[/cred_generic_field]
</td>
</tr>
<tr>
<td>

<div class="form-subject">Budget: $</div>

[cred_generic_field field='budgetpsf' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

<div class="form-subject">psf </div>
</td>
<td>
<div class="form-subject">Rental $</div>
[cred_generic_field field='budgetquantum' type='numeric' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":""
}
[/cred_generic_field]

<div class="form-subject">per month</div>
</td>
</tr>
[/cred_show_group]

<tr>
<td colspan="2">

<div class="commentenquiry"> Comments / Enquiry:</div>
[cred_generic_field field='commentenquiry' type='textarea' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":"Tell me..."
}
[/cred_generic_field]
</td>
</tr>
</table>

[/credform]
#417309

Thanks! got it.

By the way can this conditional uses checkbox rather than select?

#417312

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to here that it works.

Yes - but you need to adjust the value accordingly.

#419164

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I hope your issue is resolved now. If so, could you please kindly mark this ticket as resolved.

#419166

Tks Got it.