static JsString getDirection() { var @checked = new jQuery("input:[type=radio]:checked")[0].id; var regex = new JsRegExp("custom|customValue"); if (regex.test(@checked)) { return(new jQuery("#customValue").val().As <JsString>()); } else { return(@checked); } }
/** * Given an email, returns true or false if the it is in a valid format. * @param {String} email the email to validate * @return {Boolean} * @static */ static bool isValidEmail(JsString email) { var regex = new JsRegExp("^[a-zA-Z]\\w+(.\\w+)*@\\w+(.[0-9a-zA-Z]+)*.[a-zA-Z]{2,4}$", "i"); return(regex.test(email)); }
/** * Given a shortcode, returns true or false if the it is in a valid format. * @param {String} shortcode the short code to validate * @return {Boolean} * @static */ static bool isValidShortCode(JsString shortcode) { JsRegExp regex = new JsRegExp("^\\d{3,8}$"); return(regex.test(shortcode)); }
/* * Given a phone number, returns true or false if the phone number is in a valid format. * @param {String} phone the phone number to validate * @return {Boolean} * @static */ static bool isValidPhoneNumber(JsString phone) { var regex = new JsRegExp("^(1?([ -]?\\(?\\d{3})\\)?[ -]?)?(\\d{3})([ -]?\\d{4})$"); return(regex.test(phone)); }