【发布时间】:2017-01-20 07:23:19
【问题描述】:
我已经在谷歌上搜索了几天,找不到任何解决我的问题的方法。
我创建了一个自定义的 Alfresco Aukai dashlet 并在其中放置了一个表单:
define(["dojo/_base/declare",
"dijit/_WidgetBase",
"alfresco/core/Core",
"alfresco/core/I18nUtils",
"alfresco/dashlets/Dashlet"],
function(declare, AlfCore, I18nUtils, Dashlet) {
// First define a form...
var form = {
name: "alfresco/forms/Form",
config: {
showOkButton: true,
okButtonLabel: "Save",
showCancelButton: false,
cancelButtonLabel: "Doesn't Matter",
okButtonPublishTopic: "PUBLISH_TOPIC",
okButtonPublishGlobal: true,
widgets: []
}
};
// Define a text box...
var textBox = {
name: "alfresco/forms/controls/DojoValidationTextBox",
config: {
fieldId: "EMAIL",
name: "email",
label: "Contact",
description: "Your e-mail address",
placeHolder: "name@address.com",
validationConfig: [
{
validation: "regex",
regex: "^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$",
errorMessage: "Valid E-mail Address Required"
}
]
}
};
form.config.widgets.push(textBox);
// Define a checkbox...
var checkbox = {
name: "alfresco/forms/controls/DojoCheckBox",
config: {
fieldId: "SHOW",
name: "showEmail",
label: "Show E-mail",
description: "Uncheck to hide the e-mail field",
value: true
}
};
form.config.widgets.push(checkbox);
// Update the textbox to respond to checkbox changes...
textBox.config.visibilityConfig = {
initialValue: true,
rules: [
{
targetId: "SHOW",
is: [true]
}
]
};
return declare([Dashlet], {
/*
* Add padding to the body.
* smallpad (4px padding), mediumpad (10px padding - recommended) and largepad (16px padding)
*/
additionalCssClasses: "mediumpad",
/**
* Explicit height in pixels of the Dashlet body.
*/
bodyHeight: 200,
/**
* Id that will be used to store properties for this Dashlet.
* i.e. the Dashlet height when using the resizer.
*/
componentId: "component.messaging-dashlet",
/**
* The i18n scope to use for this Dashlet.
*/
i18nScope: "dashlets.MessagingDashlet",
/**
* An array of the i18n files to use with this Dashlet.
*/
i18nRequirements: [{i18nFile: "./i18n/MessagingDashlet.properties"}],
/**
* The widgets to be acting as title bar actions.
*/
widgetsForTitleBarActions: [
{
id: "MESSAGING_DASHLET_ACTIONS",
name: "alfresco/html/Label",
config: {
label: "Title-bar actions"
}
}
],
/**
* The widgets to be placed in the top toolbar.
*/
widgetsForToolbar: [
{
id: "MESSAGING_DASHLET_TOOLBAR",
name: "alfresco/html/Label",
config: {
label: "Toolbar"
}
}
],
/**
* The widgets to be placed in the body of the dashlet.
*/
widgetsForBody: [
{
id: "HELLO_DASHLET_VERTICAL_LAYOUT",
name: "alfresco/layout/VerticalWidgets",
config: {
widgetWidth: 50,
widgets: [
form
]
}
}
]
});
});
表单已显示,但“保存”按钮处于非活动状态。
检查 fire bug 时,我被告知页面上没有 javascript!
除此之外,一切正常,甚至在输入无效电子邮件地址时收到错误消息。
有什么建议吗?或者,在 dashlet 发布中的表单的工作示例会很好:)
我在尝试使用 OptionsService 填充选择框时对此进行了进一步研究。
optionsConfig: {
publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
publishPayload: {
url: url.context + "/proxy/alfresco/api/people",
itemsAttribute: "people",
labelAttribute: "firstName",
valueAttribute: "userName"
}
在调试中我可以看到这一点,但是通过网络没有任何反应,没有相应的请求发送到服务器!
这与我在帖子中遇到的问题相同,因此这表明我的代码存在更根本的问题。
【问题讨论】:
标签: alfresco-share