创建客户端库

创建 客户端库 其中包括用于调用方法的代码 doAjaxSubmitWithFileAttachmentguideBridge CSS类标识的按钮的点击事件上的API 保存按钮. 我们传递自适应表单数据, fileMap,和 mobileNumber 到侦听的端点 **/bin/storeafdatawithattachments

保存表单数据后,会生成一个唯一的应用程序ID并在对话框中向用户显示。 在禁用对话框时,用户将被带入表单,表单允许他们使用唯一的应用程序ID检索保存的自适应表单。

$(document).ready(function () {

  $(".savebutton").click(function () {
    var tel = guideBridge.resolveNode(
      "guide[0].guide1[0].guideRootPanel[0].contactInformation[0].basicContact[0].telephoneNumber[0]"
    );
    var telephoneNumber = tel.value;
    guideBridge.getFormDataString({
      success: function (data) {
        var map = guideBridge._getFileAttachmentMapForSubmit();
        guideBridge.doAjaxSubmitWithFileAttachment(
          "/bin/storeafdatawithattachments",
          {
            data: data.data,
            fileMap: map,
            mobileNumber: telephoneNumber,
          },
          {
            success: function (x) {
              bootbox.alert(
                "This is your reference number.<br>" +
                  x.data.applicationID +
                  " <br>You will need this to retrieve your application",
                function () {
                  console.log(
                    "This was logged in the callback! After the ok button was pressed"
                  );
                  window.location.href =
                    "http://localhost:4502/content/dam/formsanddocuments/myaccountform/jcr:content?wcmmode=disabled";
                }
              );
              console.log(x.data.path);
            },
          },
          guideBridge._getFileAttachmentsList()
        );
      },
    });
  });
});
NOTE
我们已经使用了 bootbox JavaScript库 显示对话框

此示例中使用的客户端库可以是 已从此处下载。

后续步骤

验证具有OTP服务的用户

recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e