整合
建立資料元素
AEM Formsas a Cloud Service
我們在Tags屬性中新增了兩個新資料元素(ApplicationsStateOfResidence和validationError)。
ApplicantStateOfResidence
此 ApplicantStateOfResidence 資料元素是透過選取 核心 「擴充功能」下拉式清單中的 自訂程式碼 的「資料元素型別」,如下方熒幕擷取畫面所示
下列自訂程式碼是用來從 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 資料元素是透過選取 核心 「擴充功能」下拉式清單中的 自訂程式碼 的「資料元素型別」,如下方熒幕擷取畫面所示
下列自訂程式碼是用來設定 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;
後續步驟
recommendation-more-help
4859a77c-7971-4ac9-8f5c-4260823c6f69