I created a form with the html.Form function and a callback to catch the click on the submit button, however I need to validate that the fields have information because they will be stored in fields marked as “not null” in the database. I used the “required” property in the inputs and, as expected, it shows a message asking to fill the fields. However, that doesn’t stop the callback from running and I got an error from the insert to the database.
How can I force the callback to stop when the fields are empty? I suspect that I can check for the values of the fields and if they are empty raise a PreventUpdate exception but I’m not sure this is the best approach.
Has someone made something similar? Could you suggest or share what you did?