Hello,
I am trying to achieve below 2 things and need your help please. My form consists of 5 fields (ClientName, SubmittedBy, SubmittedDate, isSaved, isSubmit) which will be save into to DB table.
1. Form is having 2 buttons save and submit. On click of Save, it should save all the 5 fields with isSubmit=false in the database and the form should not be closed. On click of Submit, the isSubmit=true and the form is closed.
2. How to create a reusable function which is called from both Save and Submit button. That function should have the a!save code which will save the fields accordingly. The below 3 lines are called in both the buttons and based on from which button is called, it should save fields.
fn (isSubmitClick) {
a!save(ri!isSaved, true), a!save(ri!txtSubmitDate, local!submittedDate), a!save(ri!txtSubmittedBy, local!userSubmitted), if(isSubmitClick, a!save(ri!isSubmit, true), a!save(ri!isSubmit, false)) /* This line is only needed in the Save button */*
}
FULL CODE:
a!localVariables( local!userSubmitted: "Tester", local!submittedDate : Today(), a!sectionLayout( label: "Section", contents: { a!textField( label: "Enter Client Name", labelPosition: "ABOVE", value: {ri!txtClientName}, saveInto: {ri!txtClientName}, refreshAfter: "UNFOCUS", validations: {} ), a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Cancel", style: "NORMAL" ), a!buttonWidget( label: "Save", style: "NORMAL", saveInto:{ a!save(ri!isSaved, true), a!save(ri!txtSubmitDate, local!submittedDate), a!save(ri!txtSubmittedBy, local!userSubmitted), } ), a!buttonWidget( label: "Submit", style: "PRIMARY", saveInto:{ a!save(ri!isSaved, true), a!save(ri!txtSubmitDate, local!submittedDate), a!save(ri!txtSubmittedBy, local!userSubmitted), a!save(ri!isSubmit, true), }, submit: true ) }, align: "START" ) } ))
Screen:
Thanks,
Discussion posts and replies are publicly visible