MichaelBarrow
8 years agoQrew Cadet
Question on custom button Javascript
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?
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?