I have a repeater form field in a SettingsModel, and the items in this repeater need to be unique, so I have a ‘code’ field (slug preset from ‘title’ field). Now, when I duplicate a record, the ‘code’ field is also duplicated.
Is there a way to empty the ‘code’ and/or ‘title’ field when I duplicate a record?
You can use the filterFields method in your model to manipulate or clear the value of the code and title fields when a record is duplicated. This will allow you to set those fields to empty or apply any other logic you need for duplication.
Do you perhaps have a example code? Because when I use the filterFields method, all of the repeater items have empty titles and codes when I open the settings page.