Home › Forums › General Issues › Overwrite value of group-field itself (using one of it's sub-fields) › Reply To: Overwrite value of group-field itself (using one of it's sub-fields)
No, you cannot change this.
A group field does not actually have a value, it only has sub fields that have values.
And this is not 100% correct. A group field is actually a repeater field that has exactly 1 row. In a repeater field the value of the repeater field in the DB is the number of rows that have been saved in the repeater. Since this number is not really needed for a group field acf set it to an empty value.
My suggestion would be to have 2 fields that are conditional on the true/false field rather than convert the text field to a group field. For example a text field and a group field that contains text fields for each language.
Then I would create an acf/save_post action. In my filter I would check the value of the true/false field and depending on how it was set I would copy the default language value from/to the other field so that if the toggle is switched the value is present.
Another option besides a acf/save_post filter would be to add custom JavaScript that transfers the content on the default language field back and forth when the toggle is changed.
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.