AMValidators.js revision 868ff5aa364759d09f6865fcd88839e4cfe5c4c0
0N/A/**
2362N/A * The contents of this file are subject to the terms of the Common Development and
0N/A * Distribution License (the License). You may not use this file except in compliance with the
0N/A * License.
0N/A *
0N/A * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
2362N/A * specific language governing permission and limitations under the License.
0N/A *
2362N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include
0N/A * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
0N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying
0N/A * information: "Portions copyright [year] [name of copyright owner]".
0N/A *
0N/A * Copyright 2015-2016 ForgeRock AS.
0N/A */
0N/A
0N/Adefine([
0N/A "jquery"
0N/A], function ($) {
0N/A var obj = {
2362N/A "validPhoneFormat": {
2362N/A "name": "Valid Phone Number",
2362N/A "dependencies": [],
0N/A "validator": function (el, input, callback) {
0N/A var phonePattern = /^\+?([0-9\- \(\)])*$/,
0N/A value = input.val();
0N/A
0N/A if (typeof value === "string" && value.length && !phonePattern.test(value)) {
0N/A callback([$.t("common.form.validation.VALID_PHONE_FORMAT")]);
0N/A } else {
0N/A callback();
0N/A }
0N/A }
0N/A },
0N/A "validEmailAddressFormat": {
0N/A "name": "Valid Email Address",
0N/A "dependencies": [],
0N/A "validator": function (el, input, callback) {
0N/A var emailPattern = /^([A-Za-z0-9_\-\.])+@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
0N/A value = input.val();
0N/A
0N/A if (typeof value === "string" && value.length && !emailPattern.test(value)) {
0N/A callback([$.t("common.form.validation.VALID_EMAIL_ADDRESS_FORMAT")]);
0N/A } else {
0N/A callback();
0N/A }
0N/A }
0N/A }
0N/A };
0N/A return obj;
0N/A});
0N/A