Builder or Repeater?
I have 3 phone number groups: Primary, Secondary, Tertiary. They are all stored in their own table columns like so: phone, phone_extension, phone_type. Then phone2...., etc. Not ideal, but what I am working with. Anyway, I would like like to only show the first phone group and if necessary, the user can add 2 more (up to the total of 3). I know i could build it all from scratch and use alpine to show/hide the fields, but figuring their might be a faster method while keeping things compact. Not complete with what i have shown, but you get the idea. Obviously i would need to show a minus if its a secondary or tertiary and make sure it removes the data when submitting those, not just hiding. Just more logic I realized after getting a bit into it. With the way the data is stored versus a bit more dynamic relationship or using a JSON column, im just wondering if someone has some better advice. I do think the current available repeater field is a bit too big too.
9 Replies
Sounds like a good use case for table repeater. 😜
@awcodes believe me, i looked at it. Same issue though as far as dealing with the data though, right?
It’s just a hasMany relationship right?
And table repeater just extends repeater, so the relation should still work.
It’s not a relationship at all. They are simply columns on the user table. That’s why it’s not as straightforward to using such fields
You question said they were stored in their own table.
In that case you’d have to process the data on save. I don’t think there’s a way around that despite what field you use.
sorry, when i said 'own table columns', that was pretty bad, but meant dedicated columns for each field
Yea. You’re just going to have to mutate the form data before saving it and before filling it.
thats what I thought. I might just stick with my existing method and finish it up
I always say make it work. Make it better later. Lol. 👍