Is it somehow possible to disable (or toggle required) a field when another field is empty.
I have a field for a link text, and I only want to require an url, if that text field is filled out…
I would assume something like this, bit it just throws an error
textTopRight:
label: Text Top (right)
type: text
width: 1/2
linkTopRight:
label: Link Top (right)
type: url
width: 1/2
required:
when:
textTopRight: true
A when
property for field properties does not exist. With when
you can show or hide fields based on conditions of other fields.
Oh I thought it was possible like that as well, based on this post: Required fields in conditional field context - #7 by texnixe
Any other solution?
I also tried this, but it didnt work
required: textTopRight
//or
required: textTopRight.isNotEmpty()
linkTopRight:
label: Link Top (right)
type: url
width: 1/2
required: true
when:
textTopRight: true
This would work if the textTopRight
field was a toggle field. There is no way to check if a text field is filled or not though and that’s the problem.
1 Like