Hi, any one can help me on i want to add new save button apart from save draft option, disabling this auto save draft function keep a new save button until i submit form that user input form data must be draft into the form
Discussion posts and replies are publicly visible
Hi shivam0001
You can have a a!buttonWidget() . If you don't wanna submit the form, configure the parameter "submit" as false. Make sure you are saving all the cdt values in their respective fields
{ a!sectionLayout( label:"Form", contents: { a!textField( label:"Name", value:ri!name, saveInto: ri!name ), a!integerField( label:"Employee Number", value: ri!empNo, saveInto: ri!empNo ) } ), a!buttonLayout( secondaryButtons: a!buttonWidget( label:"Save", style:"SECONDARY", submit:false(), value:"save", saveInto: { ri!buttonAction } ) ) }
Thanks ankitab0001, but here should a maintain new PV?
You don't need to. You can use the same pv that you are using for submit given that it's a text parameter. Just save a different value when clicked "save"
I have maintained CDT for all user inputs, for the save button should i add any new into CDT?
I wouldn't suggest buttonAction in the cdt as it's primarily used for defining the course of action. But it depends what your requirement is. Say you wannna store the status value in the cdt, you can store it as "DRAFT" when clicked on "Save" and "Confirmed/Initiated/Requested" when clicked on "Submit". Also, If you need to store that data in DB, I would suggest to call the a!writeToDataStoreEntity() in the saveInto of the "save" button.
Thanks Ankita
insted of text i have given boolen false
buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "save", confirmbuttonlabel: "data saved", cancelbuttonlabel: "data saved", value: false(), saveinto: ri!Param1, submit: false(), style: "SECONDARY", validate: false ) }
but result is
Expression evaluation error [evaluation ID = CR1I1MIU] in rule 'lv_employeeinputs' at function a!buttonWidget [line 68]: An error occurred while executing a save: Could not cast from Boolean to LV_levCDT. Details: CastInvalid
Your ri!param1 seems to be a cdt. You can't save boolean value in a cdt. Try something like this:
a!buttonWidget( label: "save", confirmbuttonlabel: "data saved", cancelbuttonlabel: "data saved", value: false(), saveinto: {ri!isSave, a!save(ri!Param1.status, "Draft") }, submit: false(), style: "SECONDARY", validate: false )
ri!isSave is optional depending if you want to use that variable somewhere else. Also, if you are saving a boolean value in a variable, try to name that variable that starts with "is".