Hello, I have a problem when trying to clean the data of a form by means of a button.The case is that I have an array of objects, and a button that when I press it saves an object in the array with the form data and creates another object. The problem is that when I press the button I also want to clean the form, because now I save the object in the array but the values remain in the form. Thank you!
Translated with www.DeepL.com/Translator (free version)
Discussion posts and replies are publicly visible
You need to clean the data used as the value for your input fields. Add one or more a!save() to the saveInto parameter of your button.
I used to save the data in the local variable. when the button clicked, the data will be saved into the target file and simultaneously the value(localvariable) will be null. Hope this code will help you..
a!localVariables( local!name,a!formLayout( label: "Form", contents: { a!textField( label: "Text", labelPosition: "ABOVE", value: local!name, saveInto: { local!name }, refreshAfter: "UNFOCUS", validations: {} ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, saveInto: { a!save( ri!name, local!name ), a!save( local!name, "" ) }, style: "PRIMARY", loadingIndicator: true ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: {}, submit: true, style: "NORMAL", validate: false ) } )))