//////////////////////////////////////// //web/WEB-INF/efw/event/myEvent.js //////////////////////////////////////// var myEvent={}; myEvent.service={ max:10, message:'system is busy,please wait a while', retriable:true, interval:20, }; myEvent.paramsFormat = { "#txt_teststring" : "display-name:Test String;max-length:10;", "#txt_testnumber" : "format:#,##0.00;required:true;display-name:Test Number;min:-10.00;max:1,000.00", "#txt_testdate" : function(){ var date1=new Date(); var date2=new Date(); date2.setDate(date1.getDate()+6); return "format:yyyy-MM-dd;required:true;display-name:Test Date;" +"min:"+date1.format("yyyy-MM-dd")+";" +"max:"+date2.format(,"yyyy-MM-dd")+";" ; }, ... }; myEvent.fire = function ( requestParams ) { return (new Result()).alert("hello world! Your entries are correct."); };
The event variable must be same to the event file name. In the sample, it is "myEvent".
myEvent.service = { max: 10, message:'System busy please wait.', retriable:true, interval:20, };
Parameters | Description | Attention |
---|---|---|
max | The max requests count can be execute at the same time. | "max" is requried for events with service definition. |
message | the message when the max requests count is reached. | "message" is optional. |
retriable | The event will try to re-execute automatically or not. | The default value is false. |
interval | The interval for re-execution. | The default value is 30 seconds. "interval" is enable only when "retriable" is true. |
myEvent.paramsFormat = { selector1 : null, selector2 : "checkStyle", selector3 : function(){ return "checkStyle"; }, { selector4 : ... , }, [ { selector5 : ... , } ], };To reference JQuery about the rules of selectors.
Type | Description | Normal | Abnormal |
---|---|---|---|
selector : null | To get a single input data from the client by the JQuery selector without input checking. | If one html tag is matched to the selector, the value attribute or text attribute will be looked as the input data to the fire method. | Error if multi tags are matched to the selector. |
selector : "checkStyle" | To get a single input data from the element matched by the JQuery selector with input checking. | If the input data is matched to the check style, it will be used. | Error if multi tags are matched to the selector. Error if the input data is not matched the check style. |
selector : function(){ return "checkStyle"; } | To get a single input data from the element with input checking matched by the JQuery selector which is created by a function. | If the input data is matched to the check style, it will be used. | Error if multi tags are matched to the selector. Error if the input data is not matched the check style. |
selector : {...} | To get several input datas stored in the element matched by the selector. | If one element is matched to the selector, it will be used. And the selector will be as the context to the sub selectors. | Error if multi tags are matched to the selector. |
selector : [{...}] | To get an array of input datas stored in the element matched by the selector. | Multi elements matched to the selector will be as the context to the sub selectors. | - |
Item | Value | Description | Error |
---|---|---|---|
display-name | String | The element name which will be shown in the check error message. | |
max-length | Number | The max length for an element. | MaxLengthOverMessage |
format | String | The number format or date format expected to an element. | NumberIsReuqiredMessage or DateIsReuqiredMessage |
min | String | The min (formatted) value to an element. | MinOrMaxOverMessage or MinOverMessage |
max | String | The max (formatted) value to an element. | MinOrMaxOverMessage or MaxOverMessage |
required | Boolean | The element is must or not. | IsRequiredMessage |
accept | String | The extension file-names seperated by "," which will be accepted as uploading files. | NotAcceptMessage |
If the event is called by batch, the event return should be an instance of Batch.