Simple repeater data passing in as string instead of array
I'm being thrown for a loop by what I thought were pretty basic repeaters. I've got two simple repeaters in my form: functions & qualifications.
They look like this in the migration:
the form fields are defined as:
and I have casts in the model:
When I initially add the record - or if I manually set them to NULL and then edit it - I can add items to the repeater. What gets stored in the database is
including the surrounding quotes. But if I edit a record that has any data in the field(s), I get the following error:
I've been up and down the Repeater docs page numerous times and I'm not seeing anything that looks out of place. Am I missing something? Any idea what I'm doing wrong?
Thanks.
5 Replies
Is this within a custom form or the panel builder?
Straight up panel builder with the form defined in the Resource class
i'm not seeing anything obvious based on the code you shared, but what is getting stored to the DB isn't right. It should still be a keyed array which is why you are getting the string error, i.e.
π€¦ββοΈ I found it. I'm extending the base Model class with a custom one that trims all string attributes on both read and write. One of the DBs I have to interact with is MS SQL Server and it feeds padded data which throws off all kinds of other things. So I was handling it at the source. These fields are being evaluated as strings and the trim must be transforming them into actual fully escaped strings. It's never caused a problem in any other app but this is the first thing I'm using a repeater on.
Handled now. Sorry for the goose chase.
No worries. Glad you figured it out.