validationrules

Javascript Regex to limit Text Field to only Numbers (Must allow non-printable keys)

≯℡__Kan透↙ 提交于 2019-11-28 00:56:41
问题 I have received PHP/JS code from previous developer and I need to add number validation to a Mobile Number field. I already have the HTML validation in place but I need to add that if someone presses an invalid key, that it doesn't get displayed only to highlight the field later in red because it contains invalid input. I've seen many regex's used and tried them but they had an either/or effect from what I need which is: If a letter or special character is entered, do not accept and do not

WPF Binding : Use DataAnnotations for ValidationRules

南楼画角 提交于 2019-11-27 01:54:49
问题 I have read a lot of Blog post on WPF Validation and on DataAnnotations . I was wondering if there is a clean way to use DataAnnotations as ValidationRules for my entity. So instead of having this (Source) : <Binding Path="Age" Source="{StaticResource ods}" ... > <Binding.ValidationRules> <c:AgeRangeRule Min="21" Max="130"/> </Binding.ValidationRules> </Binding> Where you must have your public class AgeRangeRule : ValidationRule {...} I want the WPF Binding to go see the Age property and look

Using WPF Validation rules and disabling a 'Save' button

旧巷老猫 提交于 2019-11-26 22:29:29
I have a page where a few textboxes cannot be empty before clicking a Save button. <TextBox... <TextBox.Text> <Binding Path ="LastName" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <local:StringRequiredValidationRule /> </Binding.ValidationRules> </Binding> </TextBox.Text> My rule works. I have a red border around my textbox until I enter a value. So now I want to add this validation rule to my other text boxes. Now, how do I disable the Save button until the page has no errors? I do not know what to check to see if there are any validation errors. Here is the complete