How to use the aurelia-validation.ValidationController function in aurelia-validation

To help you get started, we’ve selected a few aurelia-validation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adarshpastakia / aurelia-ui-framework / dist / commonjs / aurelia-ui-framework.js View on Github external
var registerValidators = function (container) {
    container.get(aureliaValidation.ValidationController).validateTrigger = aureliaValidation.validateTrigger.changeOrBlur;
    aureliaValidation.ValidationRules.customRule("url", function (value) {
        return value === null ||
            value === undefined ||
            value === "" ||
            /^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/.test(value);
    }, "\${$displayName} is not a valid url.");
    aureliaValidation.ValidationRules.customRule("phone", function (value) {
        return value === null || value === undefined || value === "" || libphonenumberJs.parsePhoneNumberFromString(value).isValid();
    }, "\${$displayName} is not a valid phone number.");
    aureliaValidation.ValidationRules.customRule("number", function (value, obj, min, max) {
        return value === null ||
            value === undefined ||
            value === "" ||
            (isNumber(value) &&
                value >= (isEmpty(min) ? Number.MIN_VALUE : min) &&
                value <= (isEmpty(max) ? Number.MAX_VALUE : max));
github jbockle / aurelia-json-schema-form / dist / commonjs / form / au-json-schema-form.js View on Github external
], AuJsonSchemaForm.prototype, "schema", void 0);
    __decorate([
        aurelia_framework_1.bindable,
        __metadata("design:type", Object)
    ], AuJsonSchemaForm.prototype, "form", void 0);
    __decorate([
        aurelia_framework_1.bindable({ defaultBindingMode: aurelia_framework_1.bindingMode.twoWay }),
        __metadata("design:type", Object)
    ], AuJsonSchemaForm.prototype, "model", void 0);
    __decorate([
        aurelia_framework_1.bindable,
        __metadata("design:type", Object)
    ], AuJsonSchemaForm.prototype, "options", void 0);
    __decorate([
        aurelia_framework_1.bindable,
        __metadata("design:type", aurelia_validation_1.ValidationController)
    ], AuJsonSchemaForm.prototype, "validationController", void 0);
    AuJsonSchemaForm = __decorate([
        aurelia_framework_1.inject(aurelia_validation_1.ValidationControllerFactory, schema_form_configuration_1.SchemaFormConfiguration, logger_1.SchemaFormLogger, form_service_1.FormService, form_instances_1.FormInstances),
        aurelia_framework_1.customElement('au-json-schema-form'),
        __metadata("design:paramtypes", [aurelia_validation_1.ValidationControllerFactory,
            schema_form_configuration_1.SchemaFormConfiguration,
            logger_1.SchemaFormLogger,
            form_service_1.FormService,
            form_instances_1.FormInstances])
    ], AuJsonSchemaForm);
    return AuJsonSchemaForm;
}());
exports.AuJsonSchemaForm = AuJsonSchemaForm;