I have the following form set up.
Issue is: when checking the auto-add-log-item checkbox, the additional generic fields do not show.
Has been tested on a clean install of WP/Toolset/2018 theme.
Any ideas why this might be? How can I get the fields to display?
[credform]
[cred_field field="form_messages" class="alert alert-warning"]
<div class="form-group">
<label>Item Title</label>
[cred_field field="post_title" class="form-control" output="bootstrap"]
</div>
<div class="form-group">
<label>Item Content</label>
[cred_field field="post_content" output="bootstrap"]
</div>
<div class="form-group">
[cred_generic_field type='checkbox' field='auto-add-log-item']
{
"required":0,
"default":"",
"label":"Add a log item?"
}
[/cred_generic_field]
</div>
[cred_show_group if="( $(auto-add-log-item) eq '1' )" mode="fade-slide"]
<div class="form-group">
<label>Notes</label>
[cred_generic_field type='textarea' field='notes']
{
"required":0,
"default":""
}
[/cred_generic_field]
</div>
<div class="form-group">
<label>Date Checked</label>
[cred_generic_field type='date' field='date-checked']
{
"required":0,
"default":"[wpv-post-today]"
}
[/cred_generic_field]
</div>
[/cred_show_group]
[cred_field field="form_submit" output="bootstrap" value="Submit" class="btn btn-primary btn-lg"]
[/credform]
Hi David,
Thank you for waiting.
To make the conditional group show or hide, based on a checkbox type generic field value, you'll need to set a default value, e.g.
[cred_generic_field type='checkbox' field='auto-add-log-item']
{
"required":0,
"default":"1",
"label":"Add a log item?"
}
[/cred_generic_field]
After that, you can use the conditional blocks like this:
[cred_show_group if="( $(auto-add-log-item) ne '1' )" mode="fade-slide"]
"Add a log item" field is not checked
[/cred_show_group]
[cred_show_group if="( $(auto-add-log-item) eq '1' )" mode="fade-slide"]
"Add a log item" field is checked
[/cred_show_group]
I hope this helps and please let me know how it goes.
regards,
Waqar