Skip to main content
Question

Redirect to same page in form

  • Jan 2, 2026 7:16 PM UTC
  • 5 replies
  • 229 views

Forum|alt.badge.img+3

Hi, 

I have this formula URL where the user submits all branch. when the user clicks the button it comes the chrome prompt of Leaving the site? (Picture below) 

This the code i have written in the formula url field: 

var text markCompleted = 
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&apptoken=" &
"&rid=" & URLEncode([Record ID#]) &
"&_fid_921=1" &
"&rdr="&URLEncode( URLRoot() & "db/" & Dbid() & "?a=er&dfid=34&rid=" & ToText([Record ID#]) & "&page=15")

$markCompleted


Can someone help me fix this? 

**I have remove the token. 

5 replies

MarkShnierYou
Forum|alt.badge.img+24

No problem. This is probably a very old app. Go to the Table Advanced Settings and set this setting to check

Auto save when redirected away from the page.

that has been the default for many years, so this must be an old app that is still defaulted to be unchecked

 


Forum|alt.badge.img+3
  • Author
  • Qrew Cadet
  • Jan 3, 2026 5:37 PM UTC

Hi Mark, 

I have this setting checked already. I am using the same structure of the formula URL in other button with different field ID and page number everything else is the same which works as intended. 


MarkShnierYou
Forum|alt.badge.img+24

I am not seeing any syntax errors in your formula. 

Are you running this button in Add Mode or in Edit Mode?  It is not going to run in Add Mode as constructed.


Forum|alt.badge.img+3
  • Author
  • Qrew Cadet
  • Jan 5, 2026 12:44 PM UTC

Hi Mark, 

Yes, it is on add mode. How would I do it in Edit Mode?


Top Step
Forum|alt.badge.img+12
  • Observing
  • Oct 21, 2026 8:50 PM UTC

Since it's in Add mode, the record doesn't have a Record ID yet. The API_EditRecord in your URL has nothing to edit, and the browser warns you because you're leaving an unsaved form.

Switch the button to a Formula - Rich Text field and use the SaveBeforeNavigating class with %%rid%%. Quickbase saves the record first, then swaps %%rid%% for the new Record ID before it follows the link.

var text RID = If([Record ID#] > 0, ToText([Record ID#]), "%%rid%%");
var text Back = URLRoot() & "db/" & Dbid() & "?a=er&dfid=34&page=15&rid=";
var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=yourtoken&rid=" & $RID & "&_fid_921=1&rdr=" & URLEncode($Back) & $RID;
"<a class='Vibrant Success SaveBeforeNavigating' data-replaceRid=true href='" & $URL & "'>Submit All Branch</a>"

Two gotchas. Keep %%rid%% outside of URLEncode, or it gets encoded and never replaced. And the user has to have entered something on the form, otherwise there's nothing to save.