cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting form

aviriel
Confirmed Champ
Confirmed Champ
Is it a way to add a button to reset form easily to alfresco/forms/Form? I found two ways:
1. additionalButtons attribute
I don't understand what objects should I add to this array, because simply one object with alfresco/buttons/AlfButton does not work.
2. Customizing Cancel button label and publishTopic. Here is my question. What publishTopic to use and what is a correct way to clear all fields of the form?
2 REPLIES 2

aviriel
Confirmed Champ
Confirmed Champ
This solved my problem:

var SearchForm = {
  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"
        }
      },
    ]



{
  id: "RESET_FORM",
  name: "alfresco/menus/AlfMenuBarItem",
  config: {
    label: "Reset Form",
    publishTopic: "SET_FORM_VALUE",
    publishPayload: {
      prop_1: "",
      prop_2: "",
      prop_3: null
    }
  }
}

Hi, can you please explain that how to reset form fields.

this is my quesion on community

How to reset aikau form field values?