var myForm = {
name: "alfresco/forms/DynamicForm",
config: {
setValueTopic: "SET_FORM_VALUE",
widgets: [
{
name: "alfresco/forms/controls/TextBox",
config: {
name: "prop_1",
label: "Property 1"
}
},
{
name: "alfresco/forms/controls/TextBox",
config: {
name: "prop_2",
label: "Property 2"
}
},
{
name: "alfresco/forms/controls/DateTextBox",
config: {
name: "prop_3",
label: "Property 3 - date"
}
},
],
widgetsAdditionalButtons: [
{
name: "alfresco/buttons/AlfButton",
config: {
updatePayload: false,
label: "Reset",
publishTopic: "RESET",
publishGlobal: true,
publishPayload:{ widgets:
[{
id: "RESET_FORM",
name: "alfresco/menus/AlfMenuBarItem",
config: {
label: "Reset Form",
publishTopic: "SET_FORM_VALUE",
publishPayload: {
prop_1: "",
prop_2: "",
prop_3: null
}
}
}]}
}
}
],
showOkButton : true,
okButtonLabel : "Save",
showCancelButton : false,
cancelButtonLabel : "Cancel",
setValueTopic : "RESET",
setValueTopicGlobalScope : true,
// Specify the TOPIC here
okButtonPublishTopic : "ALF_CRUD_CREATE",
okButtonPublishGlobal : true,
okButtonPublishPayload : {
// Specify the URL here to POST the data
url : "/sample/test",
}
}
};
// Add the form and services to the JSON MODEL
model.jsonModel = {
widgets : [ {
id : "SET_PAGE_TITLE",
name : "alfresco/header/SetTitle",
config : {
title : "Create Title"
}
}, myForm ],
services : [ "alfresco/services/CrudService"
]
};
I found a link that how to reset a form
https://community.alfresco.com/community/ecm/blog/2016/09/19/clearing-aikau-form-fields
but this does't working for me,
I don't know where i am wrong.
// Create the form here
var formValue = {
text: "Some value"
};
var myForm = {
name: "alfresco/forms/Form",
config: {
setValueTopic: "RESET",
setValueTopicGlobalScope: true,
okButtonPublishTopic: "MY_TOPIC",
widgets: [
{
name: "alfresco/forms/controls/TextBox",
config: {
fieldId: "FIELD1",
label: "A TextBox",
name: "text"
}
}
],
widgetsAdditionalButtons: [
{
name: "alfresco/buttons/AlfButton",
config: {
updatePayload: false,
label: "Reset",
publishTopic: "RESET",
publishGlobal: true,
publishPayload: formValue
}
}
],
value: formValue
}
};
// Add the form and services to the JSON MODEL
model.jsonModel = {
widgets : [ {
id : "SET_PAGE_TITLE",
name : "alfresco/header/SetTitle",
config : {
title : "Create Title"
}
}, myForm ]
};
While clicking on reset button it is not clearing form field values.
please help.
The button should not be inside the form, add alfButton after the form, not as "additional buttons". Then it will work. Maybe it also can work if you play a bi with scopes, but I don't know a solution, I just added a button after the form and used custom css to draw it on the same line
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.