Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert a Gravity Forms Text Field into a Tel Field
<?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
You can’t perform that action at this time.