Problem: I would like to make the featured image field required on multiple CRED forms.
Solution:
function my_cred_featured_image_validation($field_data, $form_data) { list($fields,$errors)=$field_data; $form_ids = [123,456]; if (in_array($form_data['id'], $form_ids)) { if ( empty($fields['_featured_image']['value']) ) { $errors['_featured_image']='This field is required'; } } return array($fields,$errors); } add_filter('cred_form_validate', 'my_cred_featured_image_validation', 10, 2);
Change 123,456 to a comma-separated list of form IDs.
Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by arnoldd 6 years, 6 months ago.
Assisted by: Christian Cox.