I have a form with multiple list views. For each list view I have an Add button that opens a subview where the user fills in the appropriate fields and clicks an OK button to lose the subview and enter the data in to the list and a Cancel button that is supposed to close the subview without adding data to the list. The Add button is working, but when someone clicks the Cancel button it still adds a row with default data.
The rules below are built on the View:
The only rules on the Subview are "When btnProjectNoteCancel is Clicked" and "When btnProjectNotesSave is Clicked" and both just say "then close a subview or subform"
Do I need to rework my rules on my Subview/View or is there a Condition I can add to the View's "When ProjectNotes subview is closing" to exclude Cancel from adding a row to the editable list?
Solved! Go to Solution.
A moment ago I just finished wiring up the exact same thing and Cancel works without adding a record. My Add and Cancel buttons on the subform do nothing but an unconfigured TransferData, they're just placeholders for the Form to hook into.
I noticed that your rule looks at the subform is closing event, that's going to happen for Save and Cancel. In my version which I copied from K2 Expense Claim Application Accelerator I modify the Add and Cancel events, not the closing events. In the Cancel event on the form I simply close the subview and nothing is added.
If you're stuck download the Application Accelerators and look at them.
Since ur Rules (Add new row , transfer , apply) are on subview closing , they will be applied either u Save or Cancel ,
I suggest u remove the rules from that event , and actually disable that event ,
and Modify/Configure ur "Save button" and "Cancel Button" on the Form Level , which means ,
Go to ur form , Add event when a control on subview is clicked ,
when "Save button is clicked " use the same rules u r using above inside the "subview is closing"
when "cancel button is clicked"
-Close subview only ,
In this way , ur data will only be transfer when u click on "save" button ,
Hope it helps,
Thank you both for your replies.
AhmadYaqub, your posting might work too, but I have such a large form that I'm trying to do everything I can on a View level as there is so much that has to be done on the main Form level. Therefore, I tried the View solution first and it worked.
NigelS, I made the changes you suggested and they worked. I had to change the Subview rules to unconfitured transfer data instead of close subview, change the View Cancel button rule to close the subview, change the View Add button rule to include all of the actions I had previously under the subview is closing rule, and deleted the subview is closing rule).