Commit 0438b9a3 authored by Bruno Meyer's avatar Bruno Meyer

Checagem de nome

parent 82c23ef0
......@@ -98,9 +98,9 @@
<br><br>
<label for="grupo">Grupo</label>
<br><br>
<input id="grupo_1" name="grupo" type="radio" value=1 class="pure-input-rounded"> Grupo 1 (Normal)
<input id="grupo_1" name="grupo" type="radio" value=1 class="checkbox-inline" checked=true> Grupo 1 (Normal)
<br>
<input id="grupo_2" name="grupo" type="radio" value=2 class="pure-input-rounded"> Grupo 2 (Meditaçao)
<input id="grupo_2" name="grupo" type="radio" value=2 class="checkbox-inline"> Grupo 2 (Meditaçao)
<br>
<br>
<center>
......
/* http://plugins.jquery.com/validate */
;(function(a,b,c,d){var e=['input:not([type]),input[type="color"],input[type="date"],input[type="datetime"],input[type="datetime-local"],input[type="email"],input[type="file"],input[type="hidden"],input[type="month"],input[type="number"],input[type="password"],input[type="range"],input[type="search"],input[type="tel"],input[type="text"],input[type="time"],input[type="url"],input[type="week"],textarea',"select",'input[type="checkbox"],input[type="radio"]'],f=e.join(","),g={},h=function(a,c){var f={pattern:!0,conditional:!0,required:!0},h=b(this),i=h.val()||"",j=h.data("validate"),k=j!==d?g[j]:{},l=h.data("prepare")||k.prepare,m=h.data("pattern")||("regexp"==b.type(k.pattern)?k.pattern:/(?:)/),n=h.attr("data-ignore-case")||h.data("ignoreCase")||k.ignoreCase,o=h.data("mask")||k.mask,p=h.data("conditional")||k.conditional,q=h.data("required"),r=h.data("describedby")||k.describedby,s=h.data("description")||k.description,t=h.data("trim"),u=/^(true|)$/i,v=/^false$/i,s=b.isPlainObject(s)?s:c.description[s]||{};if(q=""!=q?q||!!k.required:!0,t=""!=t?t||!!k.trim:!0,u.test(t)&&(i=b.trim(i)),b.isFunction(l)?i=l.call(h,i)+"":b.isFunction(c.prepare[l])&&(i=c.prepare[l].call(h,i)+""),"regexp"!=b.type(m)&&(n=!v.test(n),m=n?RegExp(m,"i"):RegExp(m)),p!=d)if(b.isFunction(p))f.conditional=!!p.call(h,i,c);else for(var x=p.split(/[\s\t]+/),y=0,z=x.length;z>y;y++)c.conditional.hasOwnProperty(x[y])&&!c.conditional[x[y]].call(h,i,c)&&(f.conditional=!1);if(q=u.test(q),q&&(h.is(e[0]+","+e[1])?!i.length>0&&(f.required=!1):h.is(e[2])&&(h.is("[name]")?0==b('[name="'+h.prop("name")+'"]:checked').length&&(f.required=!1):f.required=h.is(":checked"))),h.is(e[0]))if(m.test(i)){if("keyup"!=a.type&&o!==d){for(var A=i.match(m),B=0,z=A.length;z>B;B++)o=o.replace(RegExp("\\$\\{"+B+"(?::`([^`]*)`)?\\}","g"),A[B]!==d?A[B]:"$1");o=o.replace(/\$\{\d+(?::`([^`]*)`)?\}/g,"$1"),m.test(o)&&h.val(o)}}else q?f.pattern=!1:i.length>0&&(f.pattern=!1);var C=b('[id="'+r+'"]'),D=s.valid;return C.length>0&&"keyup"!=a.type&&(f.required?f.pattern?f.conditional||(D=s.conditional):D=s.pattern:D=s.required,C.html(D||"")),"function"==typeof k.each&&k.each.call(h,a,f,c),c.eachField.call(h,a,f,c),f.required&&f.pattern&&f.conditional?(c.waiAria&&h.prop("aria-invalid",!1),"function"==typeof k.valid&&k.valid.call(h,a,f,c),c.eachValidField.call(h,a,f,c)):(c.waiAria&&h.prop("aria-invalid",!0),"function"==typeof k.invalid&&k.invalid.call(h,a,f,c),c.eachInvalidField.call(h,a,f,c)),f};b.extend({validateExtend:function(a){return b.extend(g,a)},validateSetup:function(c){return b.extend(a,c)}}).fn.extend({validate:function(c){return c=b.extend({},a,c),b(this).validateDestroy().each(function(){var a=b(this);if(a.is("form")){a.data(name,{options:c});var d=a.find(f),g=c.namespace;a.is("[id]")&&(d=d.add('[form="'+a.prop("id")+'"]').filter(f)),d=d.filter(c.filter),c.onKeyup&&d.filter(e[0]).on("keyup."+g,function(a){h.call(this,a,c)}),c.onBlur&&d.on("blur."+g,function(a){h.call(this,a,c)}),c.onChange&&d.on("change."+g,function(a){h.call(this,a,c)}),c.onSubmit&&a.on("submit."+g,function(e){var f=!0;d.each(function(){var a=h.call(this,e,c);a.pattern&&a.conditional&&a.required||(f=!1)}),f?(c.sendForm||e.preventDefault(),b.isFunction(c.valid)&&c.valid.call(a,e,c)):(e.preventDefault(),b.isFunction(c.invalid)&&c.invalid.call(a,e,c))})}})},validateDestroy:function(){var a=b(this),c=a.data(name);if(a.is("form")&&b.isPlainObject(c)&&"string"==typeof c.options.nameSpace){var d=a.removeData(name).find(f).add(a);a.is("[id]")&&(d=d.add(b('[form="'+a.prop("id")+'"]').filter(f))),d.off("."+c.options.nameSpace)}return a}})})({sendForm:!0,waiAria:!0,onSubmit:!0,onKeyup:!1,onBlur:!1,onChange:!1,nameSpace:"validate",conditional:{},prepare:{},description:{},eachField:$.noop,eachInvalidField:$.noop,eachValidField:$.noop,invalid:$.noop,valid:$.noop,filter:"*"},jQuery,window);
\ No newline at end of file
......@@ -114,7 +114,38 @@ function iniciar(){
repouso();
}
function tutorial(){
var erro = 0;
if(!$("#nome").val()){
erro++;
$("#nome").css("border-color","red");
}
else{
//~ $("#nome").closest('.form-group').removeClass('has-error').addClass('has-success');
$("#nome").css("outline-color","black");
}
var grupo = 0;
if(document.getElementById("grupo_1").checked){
grupo = 1;
}
if(document.getElementById("grupo_2").checked){
grupo = 2;
}
for(var i in dataSet){
if(dataSet[i].nome == $("#nome").val() && dataSet[i].grupo == grupo){
erro++;
alert("Esta pessoa já fez o teste para esse grupo");
}
}
console.log(dataSet);
if(erro){
return;
}
document.getElementById("FormularioNome").style.display = "none";
document.getElementById("FormularioTutorial").style.display = "inline";
document.getElementById("labelTutorialCongruente").style.color = "#11aa11";
......
......@@ -32,16 +32,24 @@
.exclueTeste{
color:red;
}
.sidebar-brand{
background-color:rgba(255,255,255,0.2);
}
</style>
</head>
<body>
<div id= "horizontal" class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
<a id="menu-toggle" href="#menu-toggle" class="btn btn-secondary">MENU</a>
</div>
<div id="wrapper">
<div id= "horizontal" class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
<a id="menu-toggle" href="#menu-toggle" class="btn btn-secondary">MENU</a>
</div>
......@@ -57,7 +65,7 @@
<input id="upfile" type="file" value="upload" onchange="load_data(this.files)"/>
</div>
<li class="container-fluid text-center"><a href="index.html">Fazer teste</a></li>
<li><center><a id="menu-untoggle" href="#menu-untoggle" class="btn btn-secondary"><</a></center></li>
<li><center><a id="menu-untoggle" href="#menu-untoggle" class="btn btn-primary"><</a></center></li>
</ul>
</div>
......@@ -173,13 +181,13 @@
});
$(this).parent().addClass("sidebar-brand");
//~ $("#wrapper").removeClass("toggled");
$("#wrapper").removeClass("toggled");
});
//~ $(".container-fluid").click(function(c){
//~ $("#wrapper").removeClass("toggled");
//~ });
$("#wrapper").click(function(c){
$("#wrapper").removeClass("toggled");
});
buscaTestes();
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment