diff --git a/views/bootstrap/class.ReceiptDocument.php b/views/bootstrap/class.ReceiptDocument.php index 5c10b3c33..03489b4a9 100644 --- a/views/bootstrap/class.ReceiptDocument.php +++ b/views/bootstrap/class.ReceiptDocument.php @@ -33,55 +33,36 @@ class SeedDMS_View_ReceiptDocument extends SeedDMS_Theme_Style { function js() { /* {{{ */ header('Content-Type: application/javascript; charset=UTF-8'); + parent::jsTranslations(array('js_form_error', 'js_form_errors')); ?> -function checkIndForm() -{ - msg = new Array(); - if (document.formind.reviewStatus.value == "") msg.push(""); - if (document.formind.comment.value == "") msg.push(""); - if (msg != "") { - noty({ - text: msg.join('
'), - type: 'error', - dismissQueue: true, - layout: 'topRight', - theme: 'defaultTheme', - _timeout: 1500, - }); - return false; - } - else - return true; -} -function checkGrpForm() -{ - msg = new Array(); - if (document.formgrp.reviewGroup.value == "") msg.push(""); - if (document.formgrp.reviewStatus.value == "") msg.push(""); - if (document.formgrp.comment.value == "") msg.push(""); - if (msg != "") - { - noty({ - text: msg.join('
'), - type: 'error', - dismissQueue: true, - layout: 'topRight', - theme: 'defaultTheme', - _timeout: 1500, - }); - return false; - } - else - return true; -} $(document).ready(function() { - $('body').on('submit', '#formind', function(ev){ - if(checkIndForm()) return; - event.preventDefault(); + $("#formind").validate({ + rules: { + comment: { + required: true + }, + receiptStatus: { + required: true + }, + }, + messages: { + comment: "", + receiptStatus: "", + }, }); - $('body').on('submit', '#formgrp', function(ev){ - if(checkGrpForm()) return; - event.preventDefault(); + $("#formgrp").validate({ + rules: { + comment: { + required: true + }, + receiptStatus: { + required: true + }, + }, + messages: { + comment: "", + receiptStatus: "", + }, }); }); formField( - getMLText("revision_status"), + getMLText("receipt_status"), array( 'element'=>'select', 'name'=>'receiptStatus', @@ -164,7 +145,7 @@ $(document).ready(function() { echo ''; } $this->contentContainerEnd(); - $this->formSubmit(getMLText('submit_revision'), $revisiontype.'Revision'); + $this->formSubmit(getMLText('submit_receipt'), $receipttype.'Receipt'); ?>