Problem: I have a Form that captures two passwords. I would like to display an error message if the two passwords do not match.
Solution: Use the Forms API cred_form_validate to compare the two field values.
add_filter( 'cred_form_validate', 'require_featured_image_validation', 10, 2 ); function require_featured_image_validation( $data, $form_data ) { $forms = array(36925); if( in_array( $form_data['id'], $forms ) ){ list($fields,$errors)=$data; if ($fields['wpcf-contrasena-denuncia']['value']!=$fields['wpcf-repita-la-denuncia']['value']) { //set error message for pass2 $errors['repita-la-denuncia']='Passwords do not match'; } $data =array($fields,$errors); } return $data; }
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 15 replies, has 2 voices.
Last updated by 5 years, 2 months ago.
Assisted by: Christian Cox.