[Resolved] drop-down list of taxonomies, first choice
This thread is resolved. Here is a description of the problem and solution.
Problem:
How to set default option for taxonomy dropdown select Solution:
You need to add custom jQuery or Javascript code to your CRED form's JS box to set default option for taxonomy dropdown select.
What you mean when you say "I'm not able to use hooks"?
Here is the example - you need to add following code to your current theme's functions.php file and adjust the field name and code according to your needs:
add_filter('cred_form_validate','func_validate_taxonomy_select',10,2);
function func_validate_taxonomy_select($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//uncomment this if you want to print the field values
//print_r($fields);
//validate if specific form
if ($form_data['id']==12)
{
//check my_field value
if ($fields['wpcf-my_field']['value']!='correct_value')
{
//set error message for my_field
$errors['wpcf-my_field']='Wrong Value';
}
//check if featured image exists
if (empty($fields['_featured_image']['value']))
{
//set error message for featured image
$errors['_featured_image'] = 'Missing featured image';
}
}
//return result
return array($fields,$errors);
}
Glad to know that your original issue is resolved.
May I kindly ask you to open a new ticket with your each new question. This will help other users searching on the forum. Thank you for your understanding.