C validating tutorial
Besides, I will also discuss about using ‘select’ query in linq to retrieve data and traverse through the query results(in case of multiple result objects).
So, if the user enters ‘01234’ we should see an error message that would instruct the user about what type of data is valid for this field.
Another thing I like to do is to display the validation error message on the form in an otherwise hidden field: The problem with our last solution is that if the user saves a partially filled form, and picks it up at a later time, that error message that popped up is long gone, and the only indication that there is something wrong with the form is the modified field color.
So, having a text field contain that error message might be a good idea.
In the latter case, we set rc to false, and also display an error message.
When you play around with the function, you’ll notice that the validation function is only called when the focus leaves the field, so you have to click outside of the field to actually make that error message pop up.