mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-02 06:57:40 +00:00
use jquery validate
This commit is contained in:
parent
3d3bee169f
commit
76dffe2497
|
@ -33,30 +33,13 @@ class SeedDMS_View_TriggerWorkflow extends SeedDMS_Theme_Style {
|
|||
|
||||
function js() { /* {{{ */
|
||||
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.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() {
|
||||
$('body').on('submit', '#form1', function(ev){
|
||||
if(checkForm()) return;
|
||||
ev.preventDefault();
|
||||
$("#form1").validate({
|
||||
messages: {
|
||||
comment: "<?php printMLText("js_no_comment");?>"
|
||||
},
|
||||
});
|
||||
});
|
||||
<?php
|
||||
|
@ -69,9 +52,11 @@ $(document).ready(function() {
|
|||
$accessobject = $this->params['accessobject'];
|
||||
$document = $this->params['document'];
|
||||
$transition = $this->params['transition'];
|
||||
|
||||
$latestContent = $document->getLatestContent();
|
||||
|
||||
$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->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
|
@ -115,7 +100,8 @@ $(document).ready(function() {
|
|||
array(
|
||||
'element'=>'textarea',
|
||||
'name'=>'comment',
|
||||
'rows'=>4
|
||||
'rows'=>4,
|
||||
'required'=>false
|
||||
)
|
||||
);
|
||||
$this->formSubmit(getMLText("action_".strtolower($action->getName()), array(), $action->getName()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user