Custom repeater validation
Hey guys,
I have a repeater with some fields and a toggle like this:
I want to validate that only 1 of the fields can be active at the same time. Any tips on how to get this done?
Solution:Jump to solution
I managed to use the
Form\Set $set
function to change the value back to false. I thought this wasn't working, but after updating van v3-alpha to v3-beta it started working π
I can no-longer access the ->getOldState()
on the parent, but I managed to get this working with the ->getState()
function and checking for $approvedCount > 1
....4 Replies
You might find something in this Discord. It was asked before.
So far I managed this:
Yes I can still save my form now.
Solution
I managed to use the
Form\Set $set
function to change the value back to false. I thought this wasn't working, but after updating van v3-alpha to v3-beta it started working π
I can no-longer access the ->getOldState()
on the parent, but I managed to get this working with the ->getState()
function and checking for $approvedCount > 1
.any ideas how i can prevent form submission when using the above form to add erros on duplicate repeater items? the error gets displayed under the field but the form can be still submitted