整合

建立資料元素

AEM Formsas a Cloud Service

在Tags屬性中,我們新增了兩個新資料元素(ApplicatesStateOfResidence和validationError)。

Adaptive-form

ApplicatorStateOfResidence

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 資料元素的設定方式為:選取 核心 「擴充功能」下拉式清單中的 自訂程式碼 的資料元素型別,如下方熒幕擷取畫面所示

validation-error

下列自訂程式碼是用來設定 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;

後續步驟

建立規則

本頁內容