[{"id":"54f799b","elType":"section","settings":{"pa_condition_repeater":[]},"elements":[{"id":"a333efe","elType":"column","settings":{"_column_size":100,"_inline_size":null,"pa_condition_repeater":[]},"elements":[{"id":"146a591","elType":"widget","settings":{"shortcode":"[contact-form-7 id=\"5461\" title=\"Prueba validador RUT\"]","pa_condition_repeater":[]},"elements":[],"widgetType":"shortcode"}],"isInner":false}],"isInner":false},{"id":"32cd3e8","elType":"section","settings":{"pa_condition_repeater":[]},"elements":[{"id":"80c4e3f","elType":"column","settings":{"_column_size":100,"_inline_size":null,"pa_condition_repeater":[]},"elements":[{"id":"593db04","elType":"widget","settings":{"html":"<!doctype html>\n<html lang=\"es\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Validador de RUT HTML5<\/title>\n<\/head>\n<body>\n    <form>\n        <input type=\"text\" id=\"rut\" name=\"rut\" required oninput=\"checkRut(this)\" placeholder=\"Ingrese RUT\">\n        <button type=\"submit\">Validar RUT y Enviar Form<\/button>\n        <script>function checkRut(rut) {\n    \/\/ Despejar Puntos\n    var valor = rut.value.replace('.','');\n    \/\/ Despejar Gui\u00f3n\n    valor = valor.replace('-','');\n    \n    \/\/ Aislar Cuerpo y D\u00edgito Verificador\n    cuerpo = valor.slice(0,-1);\n    dv = valor.slice(-1).toUpperCase();\n    \n    \/\/ Formatear RUN\n    rut.value = cuerpo + '-'+ dv\n    \n    \/\/ Si no cumple con el m\u00ednimo ej. (n.nnn.nnn)\n    if(cuerpo.length < 7) { rut.setCustomValidity(\"RUT Incompleto\"); return false;}\n    \n    \/\/ Calcular D\u00edgito Verificador\n    suma = 0;\n    multiplo = 2;\n    \n    \/\/ Para cada d\u00edgito del Cuerpo\n    for(i=1;i<=cuerpo.length;i++) {\n    \n        \/\/ Obtener su Producto con el M\u00faltiplo Correspondiente\n        index = multiplo * valor.charAt(cuerpo.length - i);\n        \n        \/\/ Sumar al Contador General\n        suma = suma + index;\n        \n        \/\/ Consolidar M\u00faltiplo dentro del rango [2,7]\n        if(multiplo < 7) { multiplo = multiplo + 1; } else { multiplo = 2; }\n  \n    }\n    \n    \/\/ Calcular D\u00edgito Verificador en base al M\u00f3dulo 11\n    dvEsperado = 11 - (suma % 11);\n    \n    \/\/ Casos Especiales (0 y K)\n    dv = (dv == 'K')?10:dv;\n    v = (dv == 0)?11:dv;\n    \n    \/\/ Validar que el Cuerpo coincide con su D\u00edgito Verificador\n    if(dvEsperado != dv) { rut.setCustomValidity(\"RUT Inv\u00e1lido\"); return false; }\n    \n    \/\/ Si todo sale bien, eliminar errores (decretar que es v\u00e1lido)\n    rut.setCustomValidity('');\n}<\/script>\n    <\/form>\n<\/body>\n<\/html>","pa_condition_repeater":[]},"elements":[],"widgetType":"html"}],"isInner":false}],"isInner":false}]