Hey guys - i’ve been trying to use the validation feature, but have been a bit stuck here.
So i’m currently using an endpoint and based on response, i’m trying to raise a flag with the "otp-error’ hidden field to avoid the user going to the next step and deliever a error message in the pin field. However, it seems like the flag is not being catched by the validation method from the “verify” button and keeps navigating the user to submit. Is there something i’m currently missing here when implementing a proper validation based on endpoint response?
Hey John, form validation actually runs before your submission logic (since we don’t want to run your logic if their form is in an invalid state). That means when you set the field, validation logic has already run so it won’t show the error. You can actually skip a step and raise a validation error directly on your field using our setError API, which will short circuit the submission logic and raise the error: Context API - Feathery Docs
Hey Peter- thank you for your reply. I’m trying to use the setError logic, and still seem to struggle with it. Would it be possible to show an example of how it’s used?I’m trying to set an error to “Phone Input Field” if an invalid pin is entered. Thank you so much!
I’m currently using the function .setError like this => feathery.fields[‘Phone Pin Input’].setError(‘invalid pin’), with no luck. Is this a valid way of placing the function to flag an error? Please let me know!
Hi John. I am looking into your issue with setError on a pin field. Should have a resolution soon.
This issue is fixed. setError() will now work on the Pin field.
Thank you Eric! I am checking the resolution, but it seems the message doesnt show consistently. Seen video here: Loom | Free Screen & Video Recording Software | Loom
Just a thought - maybe the solution is having useEffect conflicts? (constantly being refreshed)
I think I replicated the behavior that you are seeing. It seems that having the button be both a trigger to a logic rule and have a save value to field action is triggering the quick clear of the validation error message. This might be a bug but likely difficult to get it behaving well in all scenarios. However, in my testing there was a quick work-around. I added a custom action as the second action on the button. This keeps the error message in place longer. Since this is a browser error, the standard behavior is that is clears in about 5 sec. Let me know if this does not work for you.
Yes i think this solution might work for now. There is a bit of a delay when showing the message, but it does show. Thank you Eric!
Hi eric, i just noticed that the solution stopped working on my form. As seen above in the video. Would you be able to replicate this?
I am looking at your form. There is a validation rule on the Phone Pin Input field that basically will make it invalid if it is filled. Is that intentional?
Hi Eric, i dont think this was intentional. I just corrected it to empty ! Thanks for pointing this out
Hi Eric - as said, in addition to the verifcation form, ii have a validation on Main Form - 3 in my Variant A: Guided Search which returns an error if the user submits a invalid phone number. Those are currently not working as well. Would you be able to check?
With logic rules we grant a lot of flexibility and power to alter the form’s behavior. This is generally good. However it can cause problems. The form has certain behaviors it is trying to maintain and one of them is to clear errors on field changes in case re-validation is required. Your verify button on the Verification Form Phone step is both setting a field value in the first action (which triggers the error clear) and also setting a field error. So there is a race condition happening here which I can replicate in another form. A universal product fix is not immediately apparent. However, I think you can possibly re-arrange things a bit and avoid the issue. Is it possible to move that set value to the auth_method field to the first step immediately before you navigate to the Verification Form Phone step? If not there then maybe put it in the pin verify rule itself although the first approach would be better. I haven’t tried this on your form so let me know how it works.
Hi eric - could we potentially get on a call to discuss the method above? I might be a little confused here, and might be helpful if we can potentially talk with screenshare to avoid confusion! My emails is firstname.lastname@example.org. Thank you so much!
Regarding Main Form - 3, it seems to work ok.
Ok. Sent a google meet invite for now. Or would you prefer to meet later?
Yes, now will be ok. See you there! Thank you so much
Actually, i dont think i received the google meet invite. Would you be able to send again?
Glad we could resolve your issue in the meet. Feel free to post a loom of the additional scrolling issue you mentioned in the call.