AdvancedCustomFields / AdvancedCustomFields/acf
Date time picker readonly field can still be changed
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Date time picker readonly fields can still be changed and saved.
To Reproduce
Steps to reproduce the behavior:
- Add a Date Time Picker field
- Set it to
readonlywhatever the way - Click on the field, datepicker shows (jquery ui component)
- Change the date
- Save
- 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
https://github.com/user-attachments/assets/d13c5724-801b-4580-9ccc-7f39d80e626b
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;
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the date picker initialization mentioned in the issue and reproduce the six listed steps with a readonly field. Confirm that the jQuery UI widget cannot change or save the value when readonly, then verify the same behavior in the browser after the fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100