mcguffin / acf-quickedit-fields

WordPress Plugin implementing Column Displaying, QuickEdit and BulkEdit for Advanced Custom Fields (ACF)
https://wordpress.org/plugins/acf-quickedit-fields/
GNU General Public License v3.0
359 stars 49 forks source link

Datepicker field not marked as readonly before value loaded #19

Closed developerabdd closed 7 years ago

developerabdd commented 7 years ago

The datepicker fields should be readonly, like the others, while their value is being loaded via AJAX.

Using:

developerabdd commented 7 years ago

The problem is simple: the script is not taking into account the fact that datepicker (and probably datetimepicker) fields have a hidden field for the value and another field for the actual value editing. Thus, i have found a quick fix but have not tested it thouroughly.

In src/js/acf-quickedit.js change the following lines:

line 17 becomes:

if ( $(this).attr("type") == "hidden" ) {
    $(this).next().prop( 'readonly', true );
} else {
    $(this).prop( 'readonly', true );
}

line 81 (previously line 76) becomes:

if ( $field.attr("type") == "hidden" ) {
    $field.next().prop( 'readonly', false );
} else {
    $field.prop( 'readonly', false );
}