集成

创建数据元素

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 数据元素通过选择进行配置 核心 “扩展”下拉列表中的和 自定义代码 类型的数据元素类型,如下面的屏幕快照所示

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;

后续步骤

创建规则

recommendation-more-help
4859a77c-7971-4ac9-8f5c-4260823c6f69