Hey guys,
we want to create a long text field and validate the input.
Actual we worked with this setup:
// GravityForms: Blocklist & Whitelist//
add_filter( 'gform_field_validation_84_64', 'custom_validation3', 10, 4 );
add_filter( 'gform_field_validation_84_65', 'custom_validation3', 10, 4 );
// PHP FUNKTION //
// Erlaubte Zeichen: a-z, A-Z, 0-9, ".", "_" //
function custom_validation3( $result, $value, $form, $field ) {
if ( ! empty( $value ) && ! preg_match('/^[a-zA-Z0-9äöüÄÖÜ._]+$/', $value ) ) {
$result['is_valid'] = false;
$result['message'] = 'Leider ist dies keine gültige Eingabe. Pro Zeile nur einen Account, verwende bitte kein @, # oder Links.';
}
return $result;
}
Our problem is, we also need to allow line breaks, like shown here.
So the question now, how can we achieve this?
Thanks for your help guys!