Dear, I’m using as the base line of code: https://docs.gravityforms.com/gform_field_input/#highlighter_445276.
I am creating a php and adding in function.php to change some information that is important of the input. The big question is, I need to make the change from type = “text” to type = “email” to all fields of the form that is email. Do you have any way to automatically identify all email input?
In my code below, my function is configured to look for the form and the specific field, which generates a bit of work and problems if a field is changed.
add_filter( 'gform_field_input', 'tracker', 10, 5 );
function tracker( $input, $field, $value, $lead_id, $form_id ) {
if ( $form_id == 1 && $field->id == 2 ) {
$input = '<input name="input_2" id="input_1_2" type="email" value="" class="large" aria-required="true" aria-invalid="false">';
return $input;
}
if ( $form_id == 2 && $field->id == 3 ) {
$input = '<input name="input_3" id="input_2_3" type="email" value="" class="large" aria-required="true" aria-invalid="false">';
return $input;
}
}
is it possible to automatically configure for the function to modify all forms created in the email field type = “text” for type = “email” without having to specify the form id and field id?