Numeric keypad on moblie device for numeric form fields

When using a mobile device is there a way to force display of the numeric keypad when entering a price or quantity in a pricing field?

I enabled HTML5 output based on this topic: Is there a way to display the telephone keypad on mobile when expected to type in numbers only? [RESOLVED]

But keypad still doesn’t display for pricing fields. I also don’t get the keypad for zip codes. I’m not sure if the keypad displays for regular numeric fields.Thanks!

Try the following PHP snippet:

// Open numeric keypad on mobile for number and quantity fields.
add_filter( 'gform_field_content', function( $content, $field, $value, $lead_id, $form_id ) {

    if ( wp_is_mobile() && ( $field instanceof GF_Field_Number || $field instanceof GF_Field_Quantity  ) ) {
        $content = str_replace( "type='", "inputmode='decimal' type='", $content );
    }

    return $content;

}, 10, 5 );

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.