Form Submission Question

Admittedly novice in Retool, but a hopefully easy to answer question: is there a way to make it so that hitting enter does not submit a form, and the user has to actually hit the button?

Hey Alvin! That is a great feature request (filed :white_check_mark:).

In the meantime, you could remove the form's submit button and replace it with a regular button! The regular button won't fire when you click enter.

hey @victoria

how to trigger the "invalid" event on the form button with a normal button?

Hey @Geool! What invalid event are you looking to trigger? If you have a normal button, you can add an event handler to do something like this:

I'm talking about the function of the form button, which invalidates the form if required fields are not filled in.

Building off Geool's question. Can you describe the function of "event: invalid" in the submit handler? And how it differs from "set disable"?

@Geool, apologies for the late reply! Basically, if the form gets submitted but it's invalid, you'd like to run an event but all while using a standalone button?

And @Ian_Stack, the Invalid event will run if 1. the form's submit button gets clicked and 2. the form is invalid (i.e. doesn't have all the required fields). The Set Disable *action *is an action you can trigger after a given event. Let me know if you have any questions about this! :slight_smile:

1 Like