Skip Navigation

[Résolu] cred_show_group not working with a cred_generic_field checkbox

This support ticket is created Il y a 5 années et 4 mois. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 réponse, has 2 voix.

Last updated by Waqar Il y a 5 années et 4 mois.

Assisted by: Waqar.

Auteur
Publications
#1168417

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]
#1168438

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

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

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.