Adding Screen Rules |
Top Previous Next |
We'll add two rules. The first screen rule will be associated with the first screen and will have a handler function, which will be called upon rule selection. Please note the condition specified in this function: it will only send the <ENTER> key when the hs.screens attribute array contains no previous screens, meaning that the connection has been established and this is the first screen received. So, this rule will help to bypass the "cics" screen when the connection is open, but not when the user returns from the log-in (the second screen).
The handler definition for this screen rule is:
apply: { handler: function (hs) { if (hs.screens.length == 1) { hs.enter(); } } }
The second screen rule will be associated with the second application screen. It will include user fields that will be used in the HTML template to bind part of the screen buffer with HTML elements. Also, it will include a couple of actions that will provide screen navigation.
The apply property will have this content:
apply: { fields: [ { name: 'shopsLastUpdate', row: 18, col: 29, len: 8 }, { name: 'accountsLastUpdate', row: 18, col: 62, len: 8 }, { name: 'username', row: 19, col: 67, len: 6 }, { name: 'password', row: 20, col: 67, len: 6 } { name: 'newPassword', row: 21, col: 67, len: 6 } ], render: { view: { template: "<H5>BLUE CARD LOGIN</H5>" } }, actions: { main: function (hs) { hs.enter(); }, exit: function (hs) { hs.pf1(); } } }
Here is the JSFiddle version to test this step:
|