Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to allow canceling of a modal form when there is field level validation?

What is the best way to allow canceling of a modal form when there is field level validation?

I have a Delphi form shown modally. In it there are TComboBoxes, TEdits, an Ok and Cancel buttons. These fields have OnExit methods the fire to check that the data is valid. However, I would like to have the Cancel button click allow the form to close without validating the fields. What happens is when the Cancel button is clicked, then the OnExit of the field is called and validation is run before the OnClick of the button which closes the form. This timing is undesirable because it causes the user to correct data that they wish to abandon. Thanks.

like image 278
user1627960 Avatar asked Aug 27 '12 15:08

user1627960


People also ask

What are the several things we need to do in order to validate a form in react?

There are two ways of validating forms with React Final Form: record-level and field-level. Record level is pretty much the same as how it's done with Formik. And just like Formik, you can also easily use Yup for implementing validation rules.

How do you validate a form?

Basic Validation − First of all, the form must be checked to make sure all the mandatory fields are filled in. It would require just a loop through each field in the form and check for data. Data Format Validation − Secondly, the data that is entered must be checked for correct form and value.


1 Answers

I abandoned data validation "on field exit" altogether. It frustrates users who know what they're doing (for example, someone may be copying data from another source and pasting on the current screen, in a way that will only make sense only when all data is pasted in--validation per field usually gets on the way of such actions).

Instead, try performing data validation when the user is ready to move on from the current screen, usually when they click the "OK" or "Next" button.

like image 77
MiGz Avatar answered Sep 20 '22 10:09

MiGz