I'm not totally tracking the issue, but your button is just opening a record in edit mode vs. displaying the record (the url query string contains
a=er vs. a=dr), so it seems like the record is just reloading without saving changes, right?
Have you reviewed the Table Advanced Settings to ensure the "Auto save when redirected away from the page" box is checked?
Also, it sounds like you are aware, but on the Form level (not Table level) we can control button visibility via the "
Show Save & close and Cancel buttons at the end of this form" and "Show save & keep working choice" boxes. So an alternative solution may be to create a separate form and assign this form as the default for Users in certain Roles. You can point the Users in a given form using the dfid=[YourFormID] query string parameter and in the Form UI to use the native QB controls. I'm not sure that's a feasible option in your use case, but wanted to throw it out there!
See attached screenshots.
------------------------------
Brian
------------------------------
Original Message:
Sent: 11-17-2022 17:39
From: Christopher Greene
Subject: Save and Keep Working behavior in a Custom button
The native behavior of Save & Keep Working will save Both the edit made to embedded child records and whatever changes made in the form to the parent record. The code below Does Not do that. I found the below at: Alternatives to common JavaScript Insertion techniques
var text rid = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");
var text url = URLRoot() & "db/" & Dbid() & "?a=er&rid=" & $rid;
"<a class=\"Vibrant Primary SaveBeforeNavigating\" data-replaceRid=\"true\" href=\"" & $url & "\">Save & Keep Working - Rich Text</a>"
My endeavor is to have a Custom Button behave the same way as the Native "Save & Keep Working" button. Save both parent and child record edits, redisplay in edit mode. Why a custom button? you may ask. Because the other options "Save & Close" and "Save & Next" I do not want to be available to the end user. Any assistance is appreciated.
Thank you,
CGreene
------------------------------
Christopher Greene
------------------------------