There is a post on adding a confirmation field on a registration form, but I’m not following the hint for adding a second field that needs confirmation on a different field (i.e., email address on the first set of fields, password on the second set of fields). If I could get a detail example of how to make this work that would be SOOO appreciated. This add-on is GREAT.




October 22, 2012 at 1:41 pm
The post in the knowledge base is kept up to date.
http://formidablepro.com/knowledgebase/formidable-hooks/frm_validate_field_entry/#kb-create-a-confirmation-field
Add all the fields to your form, then add the code to check to see if they match.
October 22, 2012 at 2:01 pm
Stephanie, thank you so much for the quick response. Sorry if I wasn't clear. I already have two fields set up for email address, file 194 checks to see that it is the same value as entered for field 99. Now I want to add a second set so that field 208 will verify against field 206 that the passwords match. I don't see how to do this on the knowledge base page, though there are some great examples I am sure I will use.
October 22, 2012 at 2:12 pm
Oh, I see. This is basic if/else if php.
add_filter('frm_validate_field_entry', 'your_custom_validation', 20, 3); function your_custom_validation($errors, $field, $value){ if ($field->id == 31){ //change 31 to the ID of the confirmation field here //stuff you already have }else if ($field->id == 35){ //copy of stuff you already have } return $errors; }October 22, 2012 at 2:24 pm
Stephanie, sorry for not knowing PHP well enough. Below is what I created, but it isn't checking the second field set (206 and 208) -
add_filter('frm_validate_field_entry', 'your_custom_validation', 20, 3);
function your_custom_validation($errors, $field, $value){
if ($field->id == 194){ //change 31 to the ID of the confirmation field here
$first_value = $_POST['item_meta'][99]; //change 30 to the field ID of the first field
}else if($field->id == 208){ //change 31 to the ID of the confirmation field here
$first_value = $_POST['item_meta'][206]; //change 30 to the field ID of the first field
if ($first_value != $value){
$errors['field'.$field->id] = 'The fields do not match.';
}
}
return $errors;
}
October 22, 2012 at 2:32 pm
add_filter('frm_validate_field_entry', 'your_custom_validation', 20, 3); function your_custom_validation($errors, $field, $value){ if ($field->id == 194){ //change 31 to the ID of the confirmation field here $first_value = $_POST['item_meta'][99]; //change 30 to the field ID of the first field if ($first_value != $value){ $errors['field'.$field->id] = 'The fields do not match.'; } }else if($field->id == 208){ //change 31 to the ID of the confirmation field here $first_value = $_POST['item_meta'][206]; //change 30 to the field ID of the first field if ($first_value != $value){ $errors['field'.$field->id] = 'The fields do not match.'; } } return $errors; }October 22, 2012 at 2:45 pm
Stephanie, thank you for your patience. That worked great! Sorry I didn't understand the first time.
Keith
Topic closed.