简体   繁体   English

服务器BPMN上的任务更改状态

[英]State of task changes on server BPMN

I have developed a coach view in which i am doing validations on button click. 我已经开发了一种教练视图,其中我在单击按钮时进行验证。 Either in case of validation success or failure the control stays on the page but for validation failure on specific fields, alerts are generated. 无论是验证成功还是失败,控件都会保留在页面上,但是对于特定字段上的验证失败,将生成警报。

I have only attached a script directly with the coach which populates tw.system.coachValidation on the specific field in case there is any validation failed else it just stays at the page. 我只直接向教练附加了一个脚本,该脚本在特定字段上填充tw.system.coachValidation,以防万一验证失败,否则它将停留在该页面上。

If i give an invalid input and the validation fails, i get the alerts on the input but when i again click on the button, it says: 'The state of the task or service has changed on the server. 如果我提供了无效的输入,并且验证失败,则会收到输入的警报,但是当我再次单击该按钮时,它会说:“服务器上任务或服务的状态已更改。 You might for example have opened the same task twice. 例如,您可能两次打开相同的任务。 Close this window and re-run the task.' 关闭此窗口,然后重新运行任务。

I have the option 'Fire Validation' property set to 'before' on coach. 我在教练上将选项“防火验证”属性设置为“之前”。 This is the script in the validation script activity. 这是验证脚本活动中的脚本。

if ( tw.local.NewPolicy.genderValue == "" || tw.local.NewPolicy.genderValue == null){ tw.system.addCoachValidationError(tw.system.coachValidation, "tw.local.NewPolicy.genderValue", "Please select the Gender"); }

function getAge(dateString) { var today = new Date(); var birthDate = new Date(dateString); var age = today.getFullYear() - birthDate.getFullYear(); var m = today.getMonth() - birthDate.getMonth(); if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { age--; } return age; }

if ( tw.local.NewPolicy.highestEducationValue == "" || tw.local.NewPolicy.highestEducationValue == null){ tw.system.addCoachValidationError(tw.system.coachValidation, "tw.local.NewPolicy.highestEducationValue", "Please select the level of Education");

if (tw.system.coachValidation.validationErrors.listLength == 0) { tw.local.AcceptBtnColor = true; tw.local.Quote = "Quote \r\n This is a Quote" }

If there is no validation failure, on return to screen i can click on the button as many times as i want and the coach will not get closed but, if/when the first time validation fails and there occur alert on the specific field which failed validation, once i hit the button again, the coach closes. 如果没有验证失败,则在返回屏幕时,我可以多次单击按钮,并且教练不会关闭,但是如果/首次验证失败并且在特定字段上出现警报,则失败验证,一旦我再次按下按钮,教练就会关闭。 I am unable to see what is going wrong. 我看不到出了什么问题。 Any help would be highly appreciated. 任何帮助将不胜感激。

Have you tried to clean the validationErrors object in begin of the validation script? 您是否曾尝试在验证脚本的开头清理validationErrors对象?

tw.system.coachValidation = new tw.object.CoachValidation();
tw.system.coachValidation.validationErrors = new tw.object.listOf.CoachValidationError();

Other point, I think you cannot set the value of tw.local.AcceptBtnColor and tw.local.Quote. 另外,我认为您不能设置tw.local.AcceptBtnColor和tw.local.Quote的值。 Maybe this feature is different depending on the version of IBM BPM but I believe that is not possible to set variables on validation scripts. 也许此功能因IBM BPM的版本而异,但我认为无法在验证脚本上设置变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM