Unique field on a form
Having an issue and unsure the cause. I have a contact number field, and trying to add unique so that on update, it can ignore it.
But its not liking the checking the user.
I can confirm the DB field is ID, and the uuid matches
9 Replies
Also tried this:
that is searching Arch_user_user.id which it is saying it is not found on arch_user_profiles
Ahh
How would I tell it to look for the relation ID?
So im editing a user currently, but contact number is in the profile table
I haven't done that yet.... I suspect $form->getRecord() is the parent and you want to get the relationshipRecord right?
Yeah, so prior to the unique validation, it worked fine.
Its just the case of the user update but not allowing duplicate contact numbers
I am unsure tbh... I would be tempted to just fire in custom validation rule for it where not equal to this value in that table
Might be the easier approach at this point, just hoping a cleaner solution worked haha
There should be a way to do it, but I personally haven't
Yeah, Id imagine so. Thanks anyway π
Still struggling to find a fix even with custom logic :/
Nevermind, found a solution. It was a simple dumb thing. I obviously was passing $form->getRecord() , but obviously its the profile relation, so I had to pass
$form->getRecord()->profile