Problem:
The issue here is that the user wanted to make his featured image field required.
Solution:
To do this you will need to use the Toolset Forms validation hook to make the field required.
Add the following to your functions.php file
add_filter('cred_form_validate','my_validation',10,2); function my_validation($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 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); }
Change the ID from 12 to the id of your form.
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.
Our next available supporter will start replying to tickets in about 0.53 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 6 years, 5 months ago.
Assisted by: Shane.