クライアントライブラリの作成
最終更新日: 2025年4月2日
- トピック:
- アダプティブフォーム
作成対象:
- 中級
- 開発者
CSS クラス savebutton によって識別されるボタンのクリックイベントで、guideBridge
API のメソッド doAjaxSubmitWithFileAttachment
を呼び出すコードを含むクライアントライブラリを作成します。**/bin/storeafdatawithattachments
でリッスンしているエンドポイントに、アダプティブフォームデータ、fileMap
および mobileNumber
を渡します。
フォームデータを保存すると、一意のアプリケーション 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()
);
},
});
});
});
ダイアログボックスを表示するために、bootbox JavaScript ライブラリを使用しました
このサンプルで使用しているクライアントライブラリは、こちらからダウンロードできます.