Const
Validates form fields against HTML5 validation and custom rules.
Uses HTML5 validation API (checkValidity()) for native validation, and supports custom validation rules for: required, minLength, maxLength, pattern (regex), and email format.
Operation data with validationErrors object (field names → error messages) and isValid boolean
validationErrors
isValid
// Validate with HTML5 validationconst result = validateForm({selectedElement: $form});// Returns: {isValid: true, validationErrors: {}} Copy
// Validate with HTML5 validationconst result = validateForm({selectedElement: $form});// Returns: {isValid: true, validationErrors: {}}
// Validate with custom rulesconst result = validateForm({ selectedElement: $form, validationRules: { password: { required: true, minLength: 8 }, email: { email: true } }});// Returns: {isValid: false, validationErrors: {password: "Must be at least 8 characters"}} Copy
// Validate with custom rulesconst result = validateForm({ selectedElement: $form, validationRules: { password: { required: true, minLength: 8 }, email: { email: true } }});// Returns: {isValid: false, validationErrors: {password: "Must be at least 8 characters"}}
Validates form fields against HTML5 validation and custom rules.
Uses HTML5 validation API (checkValidity()) for native validation, and supports custom validation rules for: required, minLength, maxLength, pattern (regex), and email format.