Save button with a redirect

  • 1
  • 1
  • Question
  • Updated 1 month ago
  • Answered
I haven`t found a thread yet with a solution that is working with me so, I am trying to to make a button that saves and redirects. Currently I am trying 

<div class='Vibrant Success' onclick='RedirectURL.value=myurlhere;editform.rl.value="";DoSave();'>Save</div>

I got my current setup from this thread https://community.quickbase.com/quickbase/topics/how-can-i-save-and-redirect-to-a-home-page 

This thread is the closest thing to what I am looking for. I would like to be able to save a form and then be redirected to a different table and its default report. Is there an easier solution? 
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Yes,

I'm just on my iPhone now, but you can use this contract.

var text URLONE =. Insert your first URL here ;
var text URLTWO =. Insert your next URL here ;

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

The first URL would be the one where you are using GenAddRecordForm
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
var Text URLONE =. https://example.quickbase.com/1 ;

var Text URLTWO =. https://example.quickbase.com/2 ;

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

Is telling me variable declaration must end with a semi colon
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
If you post hour formula I can hep correct it.  But you need to end each of the two formula variable lines with a semi colon.

var Text URLONE ="https://example.quickbase.com/1";

var Text URLTWO ="https://example.quickbase.com/2";

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

Also I had an error on the last line.
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
Ahhh yes, I forgot the quotation marks, silly mistake on my part. 

Currently the formula is:

var Text URLONE ="https://clearpath.quickbase.com/db/bmr3y249a?a=nwr";

var Text URLTWO ="https://clearpath.quickbase.com/db/bmr3y225t?a=td";

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

I too am getting an error on the last line
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Right, so I corrected that in my previous post. Needs to be $NextURL.



& "&rdr=" & URLEncode($NextURL)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
I suggest not redirecting to a splash page, , but rather displaying the saved record on an alternate form. The form would be used in View mode. For the EOTI Role.

It can have all the HTML you like using formula Rich Text Fiekd. But it can thus provide the Record ID.
Photo of Stephanie

Stephanie

  • 722 Points 500 badge 2x thumb
Currently the formula for my button is: "<a  class='Vibrant Success' href='javascript:LinkAway(\"" & URLRoot() & "db/" & Dbid() & "?a=dbpage&pagename=Thank You for Submitting.html" & "\");' >Submit</a>"

How would I change that to save and go to a specific form?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Are you asking now to display the record you just created on a different form, or do you know the record ID and the table that you want to redirect to?
Photo of Stephanie

Stephanie

  • 722 Points 500 badge 2x thumb

To display the record you just created on a different form, so that when submitted by EOTI they only see a HTML heading I display on that form as well as the record ID of the record they just submitted.  That way if they have any questions or want to follow up they can use the record ID# as a reference number.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
So for EOTI, what I do is to use 1 form set to be used, in forms usage for ADD / Edit, and then another form for View.  

Then I would just have a regular save button, not the Link away.
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
This did the trick, thank you! 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Great, thx for letting me know.
Mark
Can you tell me why you put $NextURL and not $URLTWO ?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
That was muddled,  I was trying to answer questions on an iPhone while cleaning out my basement yesterday



This would work if the first API was like API_GenAddRecordForm where you want to control where to land the user after the save.

var Text URLONE ="https://clearpath.quickbase.com/db/bmr3y249a?a=nwr";

var Text URLTWO ="https://clearpath.quickbase.com/db/bmr3y225t?a=td";

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

Sorry for that confusion.
Now I understand.  Cool :)
Photo of Adam

Adam

  • 730 Points 500 badge 2x thumb
Is there a way to do this without getting the QB prompt: 

"You've made changes to this Service Request. Do you want to save these changes before going to the next screen?"

I'd like it to just save the record and redirect, is there a way to skip the "are you sure" part? 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Try going to the Table 
Advanced Settings
and check the box for :  Save parent record automatically when a child record is created.

Photo of Adam

Adam

  • 730 Points 500 badge 2x thumb
Worked perfectly! Thank you! 
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
Hey Mark,

I'm trying to set this up to send me to a certain report (within the same table) once I click the save button in a form. Is this possible?

I've set up the following in a Formula URL field and placed the button in the form:

var Text URLONE ="[my data entry form URL]";
var Text URLTWO ="[my report URL]";
$URLONE 
& "&NextURL=" & URLEncode($URLTWO) 

But, it's only saving and keeping me in the same form, opened to the next new record.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
It should work.  Can you post your complete code?  You can disguise any company specific info if you need to.
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
var Text URLONE ="https://tltransportation.quickbase.com/db/bm3qmxh8k?a=nwr";

var Text URLTWO ="https://tltransportation.quickbase.com/db/bm3qmxh8k?a=q&qid=22";

$URLONE 
& "&NextURL=" & URLEncode($URLTWO)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
It really should work

Maybe try  this

var Text URLONE ="https://tltransportation.quickbase.com/db/bm3qmxh8k<b alt="" title="" name="" value="" type="" target="" rel="">?act=API_GenAddRecordForm</b>;

var Text URLTWO ="https://tltransportation.quickbase.com/db/bm3qmxh8k?a=q&qid=22";

$URLONE 
& "&NextURL=" & URLEncode($URLTWO)
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
Thanks! I'm getting this error back though 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
something got messed up on my post by this forum when i tried to bold the change.

try this for the first formula variable.


var Text URLONE ="https://tltransportation.quickbase.com/db/bm3qmxh8k?act=API_GenAddRecordForm";
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
Strange, it is opening a new record in a separate tab while leaving the original record open and unsaved. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
The checkbox on the URL formula field should not be set to open in a new tab.

But let me be sure I understand what your workflow is.  Your are supposed to have this button on the report.  You click the button and a blank form should open.  You then save the record normally and it should re-display the report.
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
Mark,

I unchecked the open in new tab box, and now it does save the record, closes it, and opens a new one in its place. That is an improvement! but not the one I was looking for. It also prompts me with this at every click, which would be tedious for users:



Any ideas around this prompt?

As for your request:

Current workflow: The user goes to Table X, clicks "Add New Record", fills out data in form, clicks "Save & close", user is shown the saved record (view mode).

Desired workflow: The user goes to Table X, clicks "Add New Record", fills out data in form, clicks "Save & close", user is shown a report called "Today's Records" that I've created. 

This way they can keep track of records already entered for the day

Thank you for your help so far!!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
The intention is for this button to be on the report.  You would launch off the report.  There would be a column of identical buttons on the report.  The user would click any of the identical buttons to start the workflow. 
Photo of Tyler Parker

Tyler Parker

  • 728 Points 500 badge 2x thumb
Ah I see now, it works perfectly, thanks for clearing that up!! I was placing it within the form itself.
(Edited)

This conversation is no longer open for comments or replies.