创建客户端库
创建客户端库,该库将包含用于在CSS类 保存按钮 标识的按钮的单击事件上调用guideBridge
API的方法doAjaxSubmitWithFileAttachment
的代码。 我们将自适应表单数据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库来显示对话框
此示例中使用的客户端库可以从此处下载。
8de24117-1378-413c-a581-01e660b7163e