Skip to content

Date time picker readonly field can still be changed #976

@nlemoine

Description

@nlemoine

Describe the bug

Date time picker readonly fields can still be changed and saved.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Date Time Picker field
  2. Set it to readonly whatever the way
  3. Click on the field, datepicker shows (jquery ui component)
  4. Change the date
  5. Save
  6. You have been able to change and save a readonly field :/

Expected behavior

Honor readonly field attribute, even when a JS widget enhances it.

Screenshots or Video

Enregistrement.de.l.ecran.2025-09-19.a.11.44.45.mov

Code
Please drag and drop an export of your field group, option page, custom post type or taxonomy JSON here.
If your issue relates to ACF Blocks, please also provide a reproducable code example of your ACF Block including it's block.json so we can reproduce the issue.

Version Information:

  • WordPress Version 6.8.2
  • PHP Version 7.4
  • ACF Version Pro 6.5.1
  • Browser Chrome 140

Additional context

I would have kindly debugged that and submitted a Pull Request for this if only you provided the unminified version of your assets 🙄 (Ping #938).

BTW, this is an easy fix:

// In date picker initialize
beforeShow: function(input) {
    if ($(input).attr('readonly') || ) {
        return false;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions