Encompass web form – Load event

Here are codes for web form – Load event – ES5 and ES6/2017

Load Event
• Example Use Case:
The administrator creates a form with three group boxes: “VA Data,” “Conventional Data,” and “FHA Data.” Upon loading the form, the group boxes will be hidden or displayed depending on the value in the “Loan Type” text box.

If the value in the “Loan Type” text box is “VA,” then the “Conventional Data” and “FHA Data” group boxes are hidden and the “VA Data” group box is displayed.

Sample Code:
ES5
function form_load(ctrl) {
elli.script.getObject(‘loan’).then(function(loanObj) {
loanObj.getField(‘1172’).then(function (value) {
if (value === ‘FHA’) {
elli.script.getObject(“GroupBox1”).then(function (gb) {
gb.visible(true); })
elli.script.getObject(“GroupBox2”).then(function (gb) {
gb.visible(false); });
elli.script.getObject(“GroupBox3”).then(function (gb) {
gb.visible(false); });
}// end if
else if (value === ‘VA’) {
elli.script.getObject(“GroupBox1”).then(function (gb) {
gb.visible(false); })
elli.script.getObject(“GroupBox2”).then(function (gb) {
gb.visible(true); });
elli.script.getObject(“GroupBox3”).then(function (gb) {
gb.visible(false); });
}// end else if
})// loanObj
}) //elli
}//end function

 

ES6/ES2017
npm install –global @elliemae/elli-cli
async function form_load(ctrl)
{
var loan = await elli.script.getObject(“loan”);
var LoanType = await loan.getField(‘1172’);
var VAGroupBox = await elli.script.getObject(“GroupBox1”);
var ConvGroupBox = await elli.script.getObject(“GroupBox2”);
var FHAGroupBox = await elli.script.getObject(“GroupBox3”);
if(LoanType === “VA”)
{
VAGroupBox.visible(true);
ConvGroupBox.visible(false);
FHAGroupBox.visible(false);
}
else if(LoanType === “Conventional”)
{
VAGroupBox.visible(false);
ConvGroupBox.visible(true);
FHAGroupBox.visible(false);
}
else if(LoanType === “FHA”)
{
VAGroupBox.visible(false);
ConvGroupBox.visible(false);
FHAGroupBox.visible(true);
}
}

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.