Skip to main content
Question

Question on custom button Javascript

  • February 17, 2018
  • 0 replies
  • 70 views

I have a custom button (Startup) on a form (Client) that gets clicked from an embedded report (Client Services). It looks like this on the form:
https://www.screencast.com/t/ooRhLeJaFac

The button opens up an add record form on a child table to the Client Services table (Service Changes) and pre-populates a few fields. When the user clicks Save to add that child record, it returns control to the top of the calling form (Clients).

And here's my current Javascript that is working well:

"<a class='Vibrant Primary' href='" &
URLRoot() & "db/" & [_DBID_SERVICE_CHANGES] & "?act=API_GenAddRecordForm" & 
"&_fid_7=" & URLEncode("Startup") & 
"&_fid_44=" & [Unique Primary Key] & 
"&_fid_46=" & [Related ClientCode] & 
"&_fid_47=" & [Related Service] &  
"&z=" & Rurl() & 
 "'>Startup</a>"

I'd like to be able to add two more pieces of functionality to this button:

1) When it returns control to the calling form, it only goes back to the top of the form. This is a very long form with a lot of information on it, and I'd love to have it automatically jump back down to the embedded report it was called from.

2) There's one other piece of logic I'd like to add to the button. Is there any way it can also open a specified URL (from another field in the calling record) and do it where it opens a new browser tab and leaves it open for the user to get to later, and immediately jumps into its current working logic which opens the add record form and when the user clicks Save, it returns control to the original calling form's embedded report section?
This topic has been closed for replies.

  • Quickbase Alumni
  • February 17, 2018
If I'm following you correctly, I might have a suggestion.

I'd use a pop-up window, (or a new tab), and then when the user 'saves' the new record, it saves and closes the tab, thus returning the user to the original section of the original form.

Michael,

I think that this would work as a formula URL button to position to a spot on the form.

var text URLONE = URLRoot() & "db/" & [_DBID_SERVICE_CHANGES] & "?act=API_GenAddRecordForm" & 
"&_fid_7=" & URLEncode("Startup") & 
"&_fid_44=" & [Unique Primary Key] & 
"&_fid_46=" & [Related ClientCode] & 
"&_fid_47=" & [Related Service];


var text URLTWO = urlroot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#] & "#JumpTarget";


$URLONE
& "&NextURL=" & URLEncode($URLTWO)



Then you would have a formula Rich Text field on the form near where you want to jump to

"<a name=JumpTarget></a>"


But I see that Matthew also posted an answer and his method may be easier to try first.

  • Quickbase Alumni
  • February 19, 2018
>And here's my current Javascript that is working well:

"<a class='Vibrant Primary' href='" &
URLRoot() & "db/" & [_DBID_SERVICE_CHANGES] & "?act=API_GenAddRecordForm" & 
"&_fid_7=" & URLEncode("Startup") & 
"&_fid_44=" & [Unique Primary Key] & 
"&_fid_46=" & [Related ClientCode] & 
"&_fid_47=" & [Related Service] &  
"&z=" & Rurl() & 
 "'>Startup</a>"
That's the problem - there is no JavaScript in your code. You can acheive what you want using script. The above example uses the &z and undocumented formula function Rurl() to return to the prior page. I am afraid there is not way to force this redirection scheme to position you back to a particular scroll post after then API_GenAddRecordForm page saves and redirects.

However, you can use the rl & RedirectURL parameters along with the IOL technique to navigate you back to the desired scroll position. I have a demo in preparation and will post it when I have some free time.

This post may be of some help at least in understanding the variety of redirection schemes used by QuickBase:

The Hunt for Redirection Parameters
https://community.quickbase.com/quickbase/topics/the-hunt-for-redirection-parameters