On Submit Action Rollback

Is there way to perform an action in the submit action the will rollback the form submittion if certain conditions apply?
I need to check a new user form against existing emails (also not a feature maybe for private don’t know…) but if the email exists I don’t the form to be submitted and only show a notification of failure.

I know I can custom a detail screen with buttons and add row actions to do this, but seams like the submit action is made for these kind of actions.

Create a relation between the column that’s storing the input value and the destination column in your users table. If that relation is not empty, then you have a duplicate.

yes good idea for the validation. but the new row will still be added to the list if I understand correctly.
I can later delete this row in GS script but I need to inform the user submitting the form that there is a duplicate and reenter the email.
seems like a lot of workarounds for a simple “don’t submit if” action isn’t it?

Sorry, I was on my mobile when I wrote the earlier response, so it was a little terse.

The idea with the relation is to prevent the form submission in the first place.
If you’re using the native form then options in this regard may be limited, but at the very least you could have a warning (Hint component?) that has a visibility condition that causes it to appear when that relation is not empty.

If you’re creating your own form with your own custom submit button, then you have full control and can explicitly prevent a new row from being added if it would create a duplicate.

Thank you!

You could actually take the approach that I described below :arrow_down: and apply it to this situation.

1 Like