-
-
Save hirejordansmith/a646fad49b0bd287ca43832050352750 to your computer and use it in GitHub Desktop.
Convert a Gravity Forms Text Field into a Tel Field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_field_input', 'hjs_change_input_type', 10, 5 ); | |
function hjs_change_input_type( $input, $field, $value, $lead_id, $form_id ) { | |
// Replace "9" with your form ID | |
// Replace "3" with your field ID | |
// Replace tabindex="1" with the tabindex value of the field being overwritten | |
if ( $form_id == 9 && $field->id == 3 ) { | |
$input = ' | |
<div class="ginput_container ginput_container_text"> | |
<input name="input_' . $form_id . '" id="input_' . $form_id . '_' . $field->id .'" type="tel" class="medium" value="' . $value . '" tabindex="1"> | |
</div>'; | |
} | |
return $input; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment