我一直在谷歌搜索几天,无法找到解决问题的方法。
我创建了一个自定义的Alfresco Aukai破折号并在其中放置了一个表单:
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
]
}
}
]
});
});
显示表单,但“保存”按钮处于非活动状态。
当检查火警时,我被告知页面上没有javascript!
除此之外,当输入无效的电子邮件地址时,每件事情都能正常工作,甚至会收到错误消息。
有什么建议吗?或者,一个小面板发布中的表单的工作示例将是很好的:)
在尝试使用OptionsService填充选择框时,我进一步研究了这个问题。
optionsConfig: {
publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
publishPayload: {
url: url.context + "/proxy/alfresco/api/people",
itemsAttribute: "people",
labelAttribute: "firstName",
valueAttribute: "userName"
}
在调试中我可以看到这个但是没有任何事情发生在线上,没有相应的请求发送到服务器!
这与我在帖子中遇到的问题相同,所以这会对我的代码提出更基本的问题。
答案 0 :(得分:0)
您的表单没有定义任何小部件/控件。
okButtonPublishGlobal: true,
widgets: []
请使用aikau http://www.codingfreaks.net/2015/03/aikau-form-example-for-simple-student.html
参考简单的CRUD示例
你能看一下这个链接吗?
Alfresco分享正在使用 Site Contributor Breakdown Dashlet ,输入表单控件使用aikau。