我试图通过一个简单的例子来帮助下面的问题。 任何人都可以提供-aikau-form-example-with-data-loading
基本上,当表单对话框加载并想要在对话框中显示文档库 noderef 时,我会做一个 repo 请求。所以我在对话框加载期间调用了 makeRepoRequest(),但是网络选项卡抛出 401 错误。
请告诉我,这个样本有什么问题?
/* studentForm.get.js */
function makeRepoRequest()
{
var alfDestination = "something";
var site = page.url.templateArgs.site;
var result = remote.call("/slingshot/doclib/container/" + site + "/documentLibrary");
return result.status.code;
if (result.status.code == status.STATUS_OK) {
alfDestination = JSON.parse(result).container.nodeRef;
}
}
var formControls = [
{
name: "alfresco/forms/controls/TextBox",
config: {
name: "name1",
label:"Name",
placeHolder:"Enter Name Here",
visibilityConfig: {
initialValue: true
}
}
},
{
name: "alfresco/forms/controls/TextBox",
config: {
label:"Age",
name: "age",
placeHolder:"Enter Age Here",
visibilityConfig: {
initialValue: true
}
}
}
,
{
name: "alfresco/forms/controls/TextBox",
config: {
label:"NodeRef",
name: "nodeRef",
visibilityConfig: {
initialValue: true
},
value : makeRepoRequest()
}
}
];
var showDialog = {
name: "alfresco/buttons/AlfButton",
config: {
readOnly:"true",
id:"dialog1",
label: "Create New Student",
additionalCssClasses: "call-to-action",
publishTopic: "ALF_CREATE_FORM_DIALOG_REQUEST",
publishPayloadType: "PROCESS",
publishPayload: {
dialogTitle: "Student Form",
dialogConfirmationButtonTitle: "Register",
dialogCancellationButtonTitle: "Cancel",
formSubmissionTopic: "ALF_CRUD_CREATE",
formSubmissionPayloadMixin: {
url: "api/type/cm%3Astudent/formprocessor"
},
fixedWidth: true,
widgets: formControls
}
}
};
model.jsonModel = {
widgets :[showDialog
],
services : [
"alfresco/dialogs/AlfDialogService",
"alfresco/services/CrudService"
]
};