mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
replace old form validation with jquery validation
This commit is contained in:
parent
5049169d09
commit
bb10ff084b
|
@ -33,30 +33,22 @@ class SeedDMS_View_OverrideContentStatus 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 checkForm()
|
|
||||||
{
|
|
||||||
msg = new Array();
|
|
||||||
if (document.form1.overrideStatus.value == "") msg.push("<?php printMLText("js_no_override_status");?>");
|
|
||||||
if (document.form1.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', '#form1', function(ev){
|
$("#form1").validate({
|
||||||
if(checkForm()) return;
|
rules: {
|
||||||
ev.preventDefault();
|
comment: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
overrideStatus: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
comment: "<?php printMLText("js_no_comment");?>",
|
||||||
|
overrideStatus: "<?php printMLText("js_no_override_status");?>",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
|
@ -73,6 +65,9 @@ $(document).ready(function() {
|
||||||
$reviewStatus = $content->getReviewStatus();
|
$reviewStatus = $content->getReviewStatus();
|
||||||
$approvalStatus = $content->getApprovalStatus();
|
$approvalStatus = $content->getApprovalStatus();
|
||||||
|
|
||||||
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
||||||
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
||||||
|
|
||||||
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||||
$this->globalNavigation($folder);
|
$this->globalNavigation($folder);
|
||||||
$this->contentStart();
|
$this->contentStart();
|
||||||
|
@ -93,6 +88,7 @@ $(document).ready(function() {
|
||||||
array(
|
array(
|
||||||
'element'=>'textarea',
|
'element'=>'textarea',
|
||||||
'name'=>'comment',
|
'name'=>'comment',
|
||||||
|
'required'=>true,
|
||||||
'rows'=>4,
|
'rows'=>4,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user