Skip to content

Instantly share code, notes, and snippets.

@zaidepilef
Created September 27, 2017 20:59
Show Gist options
  • Save zaidepilef/d64764c26be5a7a8a3bcde7509ec2e6a to your computer and use it in GitHub Desktop.
Save zaidepilef/d64764c26be5a7a8a3bcde7509ec2e6a to your computer and use it in GitHub Desktop.
validacion JS para MVC5 en la carpeta Script
function convertToUtc(str) {
if (str != null) {
var date = new Date(str);
var year = date.getUTCFullYear();
var month = date.getUTCMonth() + 1;
var dd = date.getUTCDate();
var hh = date.getUTCHours();
var mi = date.getUTCMinutes();
var sec = date.getUTCSeconds();
theDate = year + "-" + pad(month, 2) + "-" + pad(dd, 2);
theTime = " 00:00:00";
return [theDate, theTime].join("T");
} else {
return str;
}
}
function validaCamposIngreso() {
$(".char").alpha();
$(".form-onlychar").alpha();
$(".email").alpha({ allow: "@@.0123456789_-", ichars: '-´\~`=?*¿+}{)(/&%$#"!¡¨[];,:¬°<>|´~`\^\'.\\' });
$(".form-patente").alpha({ allow: "0123456789", ichars: '-´\~`=?*¿+}{)(/&%$#"!¡¨[];,:¬°<>|´~`\^\'.\\' });
//$(".form-rut").numeric({ decimal: false, negative: false });
//$(".form-number").numeric({ decimal: false, negative: false });
$(".form-rut").number({ allow: "1", disallow: "\.-", allowMinus: false});
$(".form-number").number({ allow: "1", disallow: "\.-", allowMinus: false });
$(".fecha").number({ allow: "/", disallow: "." });
$(".form-decimal").number({ allow: ",", disallow: "\.-", allowMinus:false});
$(".especial").alphanum({ allowNumeric: true, allow: ".,?%-+$:/" });
$(".no-caracteres-especiales").alphanum({ allowNumeric: true, disallow: "\W" });
$(".no-caracteres-especiales-direccion").alphanum({ allowNumeric: true, allow: ".,", disallow: "\W" });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment