Assume I have a form which saves many parameters into a rule input myDataDict of a custom data type with different entries, let's say myDataDict.name (required field) and myDataDict.common is directly visible on my interface. However, in addition to the visible things, I want to automatically populate myDataDict.timestamp with the date-time when the submit-button is pressed.
How do I do that in the most standard way? Where do I have to place my a!save()-call? Inside my a!buttonWidget() ?
Discussion posts and replies are publicly visible
I do that in the submit button. Have very good experience with it.
I am still not sure how exactly: May you share some code, please? Inside the saveInto() ?
Hi ,
As per your requirement you can try this code
a!buttonWidget( label: "Submit", saveInto: a!save(ri!abc,"abc"), submit: true, style: "PRIMARY" )
thanks,
Adding to that, I recommend to keep to the best practice of using keyword syntax.
saveInto: a!save(target: ri!abc, value: "abc"),
You can also save as many fields as you need to using an array. For instance,
a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY", saveInto: { a!save( target: ri!customer.updatedOn, value: now() ), a!save( target: ri!customer.updatedBy, value: loggedInUser() ), a!save( target: ri!cancel, value: false ) } )
I always prefer using this method of saving data on the button because you can guarantee that all the other data has been entered - otherwise, the user wouldn't be able to submit the form!