Discussions

Expand all | Collapse all

Custom Save Button

  • 1.  Custom Save Button

    Posted 27 days ago
    Looking for code to create a custom Save and Redirect button on a form.  Also want to display a message for 5 seconds then redirect back to record I came from.

    Thx
    Jim

    ------------------------------
    James Blackford
    ------------------------------


  • 2.  RE: Custom Save Button

    Posted 26 days ago
    Hi Jim,

    You can find an example of a workflow like that in the Using Code Pages to Refresh with a Delay article here on Community. In the article one of our QB Solution consultant's Ryan walks through how to create a code page to handle that delay and how you could start using the same technique. This is pulled from our Code Page Sample App which contains examples of other workflows you can accomplish with code pages.

    ------------------------------
    Evan Martinez
    ------------------------------



  • 3.  RE: Custom Save Button

    Posted 26 days ago
    I also have this same issue.  From a button (rich text formula field), I am trying to do a SaveBeforeNavigating and call a code page to refresh with a delay, using the example from the Code Page Sample App.  My problem is that in the redirect, it takes me to adding a new record instead of redirecting me back to the record I was already on.  The code for the button worked correctly before I added the call to the code page.  The only problem was that I had to keep manually refreshing the form before I could see the results because the pipeline takes so long to run.  I am pretty new to Quickbase.  Can you help me figure out how to go back to the record I was on in Edit mode?  Here's the code from the button (the code page is basically the same as the code in the Code Page Sample App):

    var text rid = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");

    var text urlToExecute = URLRoot() & "db/" & Dbid() & "?a=er&rid=";

    var text url = URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=2" // Open code page 2
    & "&url=" & URLEncode($urlToExecute) & $rid; // Pass in the URL to execute

    "<a class=\"Vibrant Primary SaveBeforeNavigating\" data-replaceRid=\"true\" href=\"" & $url & "\">Show Results</a>"

    ------------------------------
    Teresa Steeg
    ------------------------------



  • 4.  RE: Custom Save Button

    Posted 26 days ago
    It seems to me the issue must be the fact that your $urlToExecute is not being encoded with the rid inside of it.

    URLEncode($urlToExecute) & $rid; 

    Instead of that try building the whole url and then encoding it there and see if that works.


  • 5.  RE: Custom Save Button

    Posted 26 days ago
    Thanks Austin, but unfortunately that doesn't resolve the problem.

    ------------------------------
    Teresa Steeg
    ------------------------------