set highlight and unhighligth functions in validato, remove old js code

This commit is contained in:
Uwe Steinmann 2017-07-13 08:52:01 +02:00
parent a34d2d8855
commit 24e34184e8
3 changed files with 12 additions and 95 deletions

View File

@ -35,37 +35,7 @@ class SeedDMS_View_AddSubFolder extends SeedDMS_Bootstrap_Style {
$strictformcheck = $this->params['strictformcheck'];
header('Content-Type: application/javascript');
?>
function checkForm()
{
msg = new Array();
if (document.form1.name.value == "") msg.push("<?php printMLText("js_no_name");?>");
<?php
if ($strictformcheck) {
?>
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
<?php
}
?>
if (msg != "") {
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
$(document).ready( function() {
/* $('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
*/
$("#form1").validate({
invalidHandler: function(e, validator) {
noty({
@ -77,6 +47,12 @@ $(document).ready( function() {
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
messages: {
name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>"

View File

@ -36,41 +36,7 @@ class SeedDMS_View_EditDocument extends SeedDMS_Bootstrap_Style {
header('Content-Type: application/javascript');
$this->printKeywordChooserJs('form1');
?>
function checkForm()
{
msg = new Array();
if ($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
<?php
if ($strictformcheck) {
?>
if ($("#comment").val() == "") msg.push("<?php printMLText("js_no_comment");?>");
if ($("#keywords").val() == "") msg.push("<?php printMLText("js_no_keywords");?>");
<?php
}
?>
if (msg != "")
{
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
$(document).ready( function() {
/*
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
*/
$("#form1").validate({
invalidHandler: function(e, validator) {
noty({

View File

@ -35,38 +35,7 @@ class SeedDMS_View_EditFolder extends SeedDMS_Bootstrap_Style {
$strictformcheck = $this->params['strictformcheck'];
header('Content-Type: application/javascript; charset=UTF-8');
?>
function checkForm()
{
msg = new Array();
if (document.form1.name.value == "") msg.push("<?php printMLText("js_no_name");?>");
<?php
if ($strictformcheck) {
?>
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
<?php
}
?>
if (msg != "") {
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
$(document).ready(function() {
/*
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
*/
$("#form1").validate({
invalidHandler: function(e, validator) {
noty({
@ -78,6 +47,12 @@ $(document).ready(function() {
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
messages: {
name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>"