Skip to main content
Question

Javascript Prompt + Edit record for Decline button

  • January 14, 2014
  • 0 replies
  • 142 views

I am trying to figure out , a way to combine the url formula button in quickbase with a Javascript Prompt and the data entered to be automatically be entered into the text field using api-edit record function.

Combining API-Edit record with Javascript with Url button.

I have created the code separately, but I cant combine them into the button.


Code for edit:

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xxxxxxxx&rid=" & [Record ID#]

& "&_fid_13=has denied this request." - to be replaced with JavaScript input variable

& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?act=dr&rid=" & [Record ID#])

Code for JavaScript Prompt

"javascript:var a = prompt('Enter your reason: ', '')"

Thank you
This topic has been closed for replies.

  • Quickbase Alumni
  • January 14, 2014
If you have an rdr parameter in your formula you are doing it wrong. Using an rdr parameter is an outdated mechanism to string together two GET requests in sequence and it has considerable shortcomings. Always use script.

The following record has a formula definition that will cause a user defined page of JavaScript to be loaded and executed. Put all of your logic and AJAX calls in the script.

Pastie Database

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=241


Pass as few variables as possible (eg QBU_rid) to the script using the formula language. You are better off recalculating or making an AJAX request to get the inputs your script needs to complete that required action rather than make your formulas more unreadable by passing variables (such as QBU_rid). I tested this script and it does exactly what you request.

  • Author
  • Quickbase Alumni
  • January 14, 2014
Thank you Dan,

Going forward i will put the logic into Javascript and use AJAX calls in the script.

  • Quickbase Alumni
  • December 2, 2014
I have the same situation, would either of you help me out please?

  • Author
  • Quickbase Alumni
  • December 4, 2014
Hey Akmal,

What are you stuck on?

  • Quickbase Alumni
  • December 5, 2014
If([On-Hold]<>true,URLRoot()&"db/"&Dbid()&"?a=API_EditRecord&rid="&[Task ID]&"&apptoken=be4************zk5nh"&"&_fid_179="&URLEncode(true)& "&rdr="&URLEncode("https://milehighgraphics.quickbase.com/db/bji*****3"),"javascript:alert('THIS TASK HAS ALREADY BEEN STARTED')")

//This is my url code to edit record but I need to include the prompt//

Thank you for taking the time to help me.

I know this is old but, is it possible to have it return to where ever it was press and not on the changed record?