mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
fix various errors and validation of form
This commit is contained in:
parent
3487a27f9d
commit
768631bf55
|
@ -33,55 +33,36 @@ class SeedDMS_View_ReceiptDocument extends SeedDMS_Theme_Style {
|
||||||
|
|
||||||
function js() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
header('Content-Type: application/javascript; charset=UTF-8');
|
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("<?php printMLText("js_no_receipt_status");?>");
|
|
||||||
if (document.formind.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
|
|
||||||
if (msg != "") {
|
|
||||||
noty({
|
|
||||||
text: msg.join('<br />'),
|
|
||||||
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("<?php printMLText("js_no_receipt_group");?>");
|
|
||||||
if (document.formgrp.reviewStatus.value == "") msg.push("<?php printMLText("js_no_receipt_status");?>");
|
|
||||||
if (document.formgrp.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
|
|
||||||
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() {
|
$(document).ready(function() {
|
||||||
$('body').on('submit', '#formind', function(ev){
|
$("#formind").validate({
|
||||||
if(checkIndForm()) return;
|
rules: {
|
||||||
event.preventDefault();
|
comment: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
receiptStatus: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
comment: "<?php printMLText("js_no_comment");?>",
|
||||||
|
receiptStatus: "<?php printMLText("js_no_receipt_status");?>",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
$('body').on('submit', '#formgrp', function(ev){
|
$("#formgrp").validate({
|
||||||
if(checkGrpForm()) return;
|
rules: {
|
||||||
event.preventDefault();
|
comment: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
receiptStatus: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
comment: "<?php printMLText("js_no_comment");?>",
|
||||||
|
receiptStatus: "<?php printMLText("js_no_receipt_status");?>",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
|
@ -148,12 +129,12 @@ $(document).ready(function() {
|
||||||
);
|
);
|
||||||
if($receiptreject) {
|
if($receiptreject) {
|
||||||
$options = array();
|
$options = array();
|
||||||
if($revisionStatus['status'] != 1)
|
if($receiptStatus['status'] != 1)
|
||||||
$options[] = array('1', getMLText("status_receipted"));
|
$options[] = array('1', getMLText("status_receipted"));
|
||||||
if($revisionStatus['status'] != -1)
|
if($receiptStatus['status'] != -1)
|
||||||
$options[] = array('-1', getMLText("rejected"));
|
$options[] = array('-1', getMLText("rejected"));
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText("revision_status"),
|
getMLText("receipt_status"),
|
||||||
array(
|
array(
|
||||||
'element'=>'select',
|
'element'=>'select',
|
||||||
'name'=>'receiptStatus',
|
'name'=>'receiptStatus',
|
||||||
|
@ -164,7 +145,7 @@ $(document).ready(function() {
|
||||||
echo '<input type="hidden" name="receiptStatus" value="1" />';
|
echo '<input type="hidden" name="receiptStatus" value="1" />';
|
||||||
}
|
}
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
$this->formSubmit(getMLText('submit_revision'), $revisiontype.'Revision');
|
$this->formSubmit(getMLText('submit_receipt'), $receipttype.'Receipt');
|
||||||
?>
|
?>
|
||||||
<input type='hidden' name='receiptType' value='<?= $receipttype ?>'/>
|
<input type='hidden' name='receiptType' value='<?= $receipttype ?>'/>
|
||||||
<?php if($receipttype == 'grp'): ?>
|
<?php if($receipttype == 'grp'): ?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user