checkRoute.js
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- function checkRoute( textValue , name )
- {
- var theObject = "document.forms[0]."+name;
- if ( ( !stripWhitespace( textValue ) || isEmpty( textValue ) ) && ( name == 'routeName') )
- {
- alert('请输入工作流模板的标题,不能为空!');
- document.forms[0].routeName.focus();
- return false;
- }
- if ( textValue.length > 30 && ( name == 'routeName') )
- {
- alert('工作流模板的标题必须小于30个字符!');
- document.forms[0].routeName.focus();
- return false;
- }
- if ( textValue.length > 800 && ( name =='description' ) )
- {
- alert('工作流描述必须小于800个字符!');
- document.forms[0].description.focus();
- return false;
- }
- return true;
- }
- function checkDescription( textValue )
- {
- if ( textValue.length > 800 )
- {
- alert(' 工作流描述必须小于800个字符!');
- document.forms[0].description.focus();
- return false;
- }
- return true;
- }
- function checkSelected()
- {
- if ( document.forms[0].subtaskList.value == '' )
- {
- alert('请选择子任务!');
- document.forms[0].subtaskList.focus();
- return false;
- }
- else
- return true;
- }
- function noMultiSelect()
- {
- var number = 0;
- for( var i =0 ; i < document.forms[0].subtaskList.length ; i++)
- {
- if ( document.forms[0].subtaskList.options[i].selected == true )
- number ++;
- }
- if ( number > 1 )
- {
- alert("只能选择一个!");
- document.forms[0].subtaskList.focus();
- return false;
- }
- else
- return true;
- }
- function onlyOne()
- {
- if ( document.forms[0].subtaskList.length == 1 )
- {
- alert("只有一个子任务存在,不能删除或排序!");
- document.forms[0].subtaskList.focus();
- return false;
- }
- else
- return true;
- }
- function moveUpDn(direction)
- {
- if ( !checkSelected() ) return false;
- if ( ! noMultiSelect() ) return false;
- myform = document.forms[0];
- myindex = -1;
- index = myform.subtaskList.options.length;
- count = 0;
- for (i = myform.subtaskList.options.length - 1; i > myindex; i--)
- {
- if (myform.subtaskList.options(i).selected == true)
- {
- count++;
- index = i;
- }
- }
- if (count == 1)
- { // Select One only
- if (direction < 0 && index > myindex + 1)
- { // Up
- newOpt = new Option(myform.subtaskList.item(index).text, myform.subtaskList.item(index).value);
- newOpt.selected = true;
- myform.subtaskList.remove(index);
- myform.subtaskList.add(newOpt, index + direction);
- }
- if (direction > 0 && index < myform.subtaskList.options.length - 1)
- { // Down
- newOpt = new Option(myform.subtaskList.item(index).text, myform.subtaskList.item(index).value);
- newOpt.selected = true;
- myform.subtaskList.remove(index);
- myform.subtaskList.add(newOpt, index + direction);
- }
- }
- submitForm('sort');
- }
- function checkSequence( subtaskList )
- {
- var list = subtaskList;
- if ( !subtaskList )
- {
- alert("子任务必须不为空!");
- return false;
- }
- var k = 0;
- if ( !list.type)
- {
- // check subtask sequence
- for( i = 0; i<list.length; i++ )
- {
- var found = 0;
- for(j = 0; j< list.length;j++)
- {
- if ( i+1 == list[j].value)
- {
- k++;
- found =1;
- }
- }
- if (k == list.length)
- {
- break;
- }
- if ( found == 0)
- {
- alert("子任务顺序必须是从1开始不间断的整数!");
- return false;
- }
- }
- }
- return true;
- }