Skip to main content
Solved

Save and New Button on Legacy form

  • June 1, 2026
  • 0 replies
  • 114 views

Forum|alt.badge.img+5

I'm trying to build what I thought would be a simple button for saving the current child record and adding a new one to the same parent record. I'm essentially just trying to duplicate the native Save & New button so I can place it next to the native Save and Close button. Will I need a code page for this?

I have programs that have many program charges and the Users want separate buttons for adding additional records and saving the record when done adding multiple charges. FID_6 is the related Program RID in the child table, Program Charges. Any thoughts would be appreciated! 

Best answer by Denin

I did it with a code page like this:

Formula on child:

var text parentValue = ToText([Related Record]); //update to your field
var text childDb = "abc123xyz"; //update to your child dbid
var number parentFid = 7; //update to related parent fid for related field above

var text url =
URLRoot() & "db/" & $childDb &
"?a=API_GenAddRecordForm" &
"&_fid_" & ToText($parentFid) & "=" & URLEncode($parentValue) &
"&NextURL=" &
URLEncode(
    URLRoot() &
    "db/" & Dbid() &
    "?a=dbpage&pageID=73" & //replace 73 with your code page ID
    "&db=" & $childDb &
    "&fid=" & ToText($parentFid) &
    "&parent=" & URLEncode($parentValue)
);

"<a class='Vibrant Success SaveBeforeNavigating' href='" & $url & "'>Save and New</a>"

Create a code page:

<!DOCTYPE html>
<html>
<head>
<script>
const p = new URLSearchParams(window.location.search);

const db = p.get("db");
const fid = p.get("fid");
const parent = p.get("parent");

window.location =
    location.origin +
    "/db/" + db +
    "?a=API_GenAddRecordForm" +
    "&_fid_" + fid + "=" + encodeURIComponent(parent) +
    "&NextURL=" + encodeURIComponent(window.location.href);
</script>
</head>
<body></body>
</html>

Button triggers the save and redirects to code page with context in the URL, and code page redirects back to record using the context.

Forum|alt.badge.img+5
  • Author
  • Registered
  • June 1, 2026

Forgot to show current button:

var text db = Dbid();

"<a class='Vibrant Success' href='" &
URLRoot() & "db/" & $db &
"?a=er" &
"&rid=" & [Record ID#] &
"&z=" & Rurl() &
"&NextURL=" &
URLEncode(
    URLRoot() & "db/" & $db &
    "?a=API_GenAddRecordForm" &
    "&_fid_6=" & ToText([Related Program])
) &
"'>Save & Add Another Charge</a>"


Forum|alt.badge.img+5
  • Author
  • Registered
  • June 1, 2026

Thanks SO much! Works great. 


Forum|alt.badge.img+5
  • Registered
  • June 1, 2026

I changed the color of the button and I bet that's what broke it. Fixed and works good.