Validate a field based on the value in another field

I have a case where I need to make sure that the values entered in 2 separate fields are identical. To do this I tried setting the Custom Rule for the second field to something like {{self.value !== myForm.data.email ? 'Emails must match' : ''}}. That appears to work because the preview of the return value shows the expected value. However, Retool briefly flashes something about "Dependency Cycle Found...", and then marks the field as having an error.

I tried doing the validation in a JavaScript Transformer -- something like {{myForm.data.email !== myForm.data.emailVerify ? 'Emails must match' : ''}} -- but that gives me the same error.

Is there a way to reference the value of another field when validating a field value?

Thanks,
Rob

1 Like

Your approach works fine for me—no errors. I tried it both inside a form and outside.

Thanks, that's helpful. My situation differs from the simple case in two ways: The form is getting data from the selected row of a table, and the form is embedded in a few containers. I'll try to cook up a smaller test case to see if I can pin down what is causing the problem.