Discussions

 View Only
  • 1.  Javascript Prompt + Edit record for Decline button

    Posted 01-13-2014 21:41

    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


  • 2.  RE: Javascript Prompt + Edit record for Decline button

    Posted 01-14-2014 10:39
    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.


  • 3.  RE: Javascript Prompt + Edit record for Decline button

    Posted 05-12-2017 14:44
    Dan, does this require IOL? I can't seem to get the button (in a formula Text or Formula URL Field) or the API to work


  • 4.  RE: Javascript Prompt + Edit record for Decline button

    Posted 05-12-2017 15:59
    Nevermind. Got it to work!


  • 5.  RE: Javascript Prompt + Edit record for Decline button

    Posted 05-28-2018 23:08
    How can I implement this to edit a record id of a different table in my app?

    Thanks


  • 6.  RE: Javascript Prompt + Edit record for Decline button

    Posted 05-28-2018 23:09
    I mean a record of a different table in my app? (the record id will be [maximum record id#])

    Thanks


  • 7.  RE: Javascript Prompt + Edit record for Decline button

    Posted 01-14-2014 14:28
    Thank you Dan,

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


  • 8.  RE: Javascript Prompt + Edit record for Decline button

    Posted 12-02-2014 02:14
    I have the same situation, would either of you help me out please?


  • 9.  RE: Javascript Prompt + Edit record for Decline button

    Posted 12-03-2014 21:12
    Hey Akmal,

    What are you stuck on?


  • 10.  RE: Javascript Prompt + Edit record for Decline button

    Posted 12-04-2014 19:26
    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.


  • 11.  RE: Javascript Prompt + Edit record for Decline button

    Posted 05-07-2018 19:51
    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?