Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form validation

I need to develop an application windows phone 7. And for obvious reasons I have to validate my forms.

I usually program in WPF and uses the principle of ValidationRule. But I can not find the same principle in windows phone 7.

Hence my question, how to create a form validation.

like image 909
David Avatar asked Mar 08 '12 14:03

David


People also ask

What is form validation?

Form validation is a “technical process where a web-form checks if the information provided by a user is correct.” The form will either alert the user that they messed up and need to fix something to proceed, or the form will be validated and the user will be able to continue with their registration process.

What is form validation explain with example?

Form validation generally performs two functions. 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.

How do you check if a form is validated?

Using the email type, we can check the validity of the form field with a javascript function called… checkValidity() . This function returns a true|false value. checkValidity() will look at the input type as well as if the required attribute was set and any pattern="" tag .


1 Answers

Windows Phone doesn't support form validations out of the box.

Here's a blog post that describes how to roll a custom control to implement validation rules.

The way I would handle this in one of my own apps would be to put the validation logic in my model class and create an IsValid property on the model. The model class would also have an Error property with an error message describing the validation issue. My UI layer would call myModel.IsValid, and display the error message if something was wrong.

like image 74
Josh Earl Avatar answered Oct 25 '22 16:10

Josh Earl