I have a "create post" frontend form with a conditional group from a dropdown select. When a value is selected, some extra fields must be shown. The conditional works well, but only the labels are shown, not the fields. I see this is caused by a style="height:auto; display:none;" that appears in the div that wraps the input fields in the frontend output.
I guess that when the condition is active (option selected), the style will be changed to display the fields, but somehow this is not happening.
The problem remains no matter I use the visual GUI or the "expert mode" to edit the form.
Hello. Thank you for contacting the Toolset support.
Can you please share admin access details so I can check whats going wrong with your setup.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
The reason why it was not working because you have also setup post field conditional display with your custom field group for the fields 'numero-de-ninos','edades','colegio'. The conditional display you set in the backed was having conflict on frontend.
=> hidden link
To fix that, I've added the following filter code to "Custom Code" section offered by Toolset with code snippet "toolset-custom-code":
=> hidden link
add_filter('cred_filter_field_before_add_to_form', 'func_adjust_conflict_conditions', 10, 1);
function func_adjust_conflict_conditions($field){
$form_id = 0;
$form_html_id = $field['form_html_id'];
if ( isset($form_html_id) ) {
$parts = explode( '_', $form_html_id);
$form_id = (int) $parts[2];
}
$field_slugs = array('numero-de-ninos','edades','colegio');
if($form_id==72 and in_array($field['id'],$field_slugs)){
// in some cases $fields['data'] is an empty string, so you'll need to first set it's expected format for PHP 7.1 compatibility
if (!is_array($field['data'])) {
$field['data'] = array();
}
$field['data']['conditional_display'] = array();
}
return $field;
}
I can see its working as expected with the form now: hidden link