在Tags屬性中,我們新增了兩個新資料元素(ApplicatesStateOfResidence和validationError)。
此 ApplicatorStateOfResidence 資料元素的設定方式為:選取 核心 「擴充功能」下拉式清單中的 自訂程式碼 的資料元素型別,如下方熒幕擷取畫面所示
下列自訂程式碼是用來從 state 最適化表單欄位。
// use the GuideBridge API to access adaptive form elements
//The state field's SOM expression is used to access the state field
var ApplicantsStateOfResidence = guideBridge.resolveNode("guide[0].guide1[0].guideRootPanel[0].state[0]").value;
_satellite.logger.log("Returning Applicants State Of Residence is "+ApplicantsStateOfResidence);
return ApplicantsStateOfResidence;
此 ValidationError 資料元素的設定方式為:選取 核心 「擴充功能」下拉式清單中的 自訂程式碼 的資料元素型別,如下方熒幕擷取畫面所示
下列自訂程式碼是用來設定 validationError
資料元素值。
var validationError = "";
// Using GuideBridge API to access adaptive forms fields using the fields SOM expression
var tel = guideBridge.resolveNode("guide[0].guide1[0].guideRootPanel[0].telephone[0]");
var email = guideBridge.resolveNode("guide[0].guide1[0].guideRootPanel[0].email[0]");
_satellite.logger.log("Got tel in Tags custom script "+tel.isValid)
_satellite.logger.log("Got email in Tags custom script "+email.isValid)
if (tel.isValid == false) {
validationError = "error: telephone number";
_satellite.logger.log("Validation error is "+ validationError);
}
if (email.isValid == false) {
validationError = "error: invalid email";
_satellite.logger.log("Validation error is "+ validationError);
}
return validationError;