Quantcast
Channel: Topic Tag: forms | WordPress.org
Viewing all articles
Browse latest Browse all 3052

Make datepicker field readonly

$
0
0

Hi,

I’m using some forms with datepicker field in order to let users to input dates. Problem is that the field is being covered by keyboard when user from smartphone.

I’ve found an old thread where you provided a snippet for a mu-plugin. The snippet was the following:

<?php

add_filter( ‘forminator_field_date_markup’, function( $html, $field ) {

if ( isset( $field[ ‘custom-class’ ] ) && strpos( $field[ ‘custom-class’ ], ‘readonly’ ) !== false ) {
$html = str_replace( ‘type=”text”‘, ‘type=”text” readonly’, $html );
}

return $html;

}, 20, 2 );

I’ve correctly installed the mu-plugin and I can see it in the must use list of my wordpress installation. However the code seems to not work and I was wondering if that snippet can be used nowadays. I have the need to set add the readonly attribute to that field.


Viewing all articles
Browse latest Browse all 3052

Trending Articles