Home › Forums › Add-ons › Repeater Field › Disabled/ReadOnly Field in repeater › Reply To: Disabled/ReadOnly Field in repeater
Hi,
It would have been more simple to help if you posted the code you used to get the User field to populate and to disabled/readonly the sub-field once it is saved.
To put you on the path (to be confirmed depending on your code) :
1) Add a specific class to the sub-field in ACF back-end (like “always_disabled”) and add some javascript by using this selector to always disabled the field (see in ACF/WP documentation how to add it properly).
2) Use the “prepare_field”/”load_value” functions to populate your sub-field value (as you probably done) and to set the field to “readonly” (required to avoid weird reaction of ACF when trying to save a JS disabled input)
3) Save the sub-field value by using “update_value” / “save_post” or other function (because the disabled and “readonly” sub-field will not be saved automatically).
It is not necessarily the ultimate solution, but it’s work for me. Hope it helps, send you code if you want more details =).
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.