How can I add a URL button that will allow users to save/update and stay in current record and form? Currently returns to form select form.

  • 2
  • 1
  • Question
  • Updated 11 months ago
  • Answered

Currently I have a Site Visit table with multiple forms that the users select when created a record.  After they save the record Quickbase takes them back to the form select form.  (I inherited this)  How can I add a URL button on the form to save/update changes to the record and keep the user in the current form and record.

Photo of Mike

Mike

  • 50 Points

Posted 3 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Try this format. This will edit using form ID #10 and then redisplay after Save on that same form.

URLRoot() & "db/" & Dbid() &  "?a=er&dfid=10&rid=" & ToText([Record ID#]) 

& "&nexturl=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&dfid=10&rid=" & ToText([Record ID#]))
Hello! This works great, except with the cancel button, when that is clicked it goes to the form that is designated as the default form for the table/role, not the form that the user was on when they clicked the custom edit button.
Photo of Mike

Mike

  • 50 Points
OK that works but now when I press the button quickbase pops up a window  asking if I want to save the record "You've made changes to the (table record name".  Do you want to save these changes before going to the next screen?"  I dont want to go to another screen.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Wait, something does not make sense.  That Button should show in View mode only.  The user clicks and edits the record and then saves the record normally and it should then redisplay on form ID #10.
Photo of Mike

Mike

  • 50 Points
ok that works but now its in view mode again so they have to press the button again after every save.  Can I code the button to stay in edit mode and just update the record?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
I am not understanding where you want to return the user to after saving.  Do you want to leave them in Edit mode after saving?  if so, then in that last line of code, change the "dr" (Display Record) to "er" (Edit Record).
Photo of Diana Connolly

Diana Connolly

  • 90 Points 75 badge 2x thumb
I am having a similar issue. The problem we are having is that Quickbase is not saving the most current excel report and when we review the report 1-2 employees' data is missing. I would like a solution to make sure not only is it saving each time but that it's saving the most current version, and replacing it automatically. Please help! Will adding a URL help? Each month they just need enter their updates, perhaps adjusting to an "edit only url" will help? If so how do I do this? TIA
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Please post a new question as its very difficult to understand what you have posted.  I don't understand what you mean by not saving the current excel report.
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
Mark, re: the code you supplied above:
URLRoot() & "db/" & Dbid() &  "?a=er&dfid=10&rid=" & ToText([Record ID#]) 

& "&nexturl=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&dfid=10&rid=" & ToText([Record ID#]))

How would I do this in a rich text field? Can this be consolidated in a Var text URL structure?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Probably.

var text URL = URLRoot() & "db/" & Dbid() & "?a=er&dfid=10&rid=" & ToText([Record ID#])

& "&nexturl=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&dfid=10&rid=" & ToText([Record ID#]));

var text Words = "Click here";

"" & $Words & ""
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
I'm trying to add this to a row of navigation buttons I've created using a rich text formula field. The problem is that the native Save button goes back to a different form.  



Here's the code:

var text bgcolor = "#4b72b0";
var text txtcolor = "white";
var text URLONE = URLRoot() & "db/" & Dbid() & "?a=er&dfid=31&rid=" & [Tracking#];
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dbpage&pagename=" & URLEncode("Service Request Form.html") & "&clist=a&rid=" & [Tracking#];
var text URLTHREE = "https://vcommerce.quickbase.com/db/bnhjmd73w?";
var text style = "style=\"text-decoration: none; background:" & $bgcolor & "; border-radius: 5px; padding: 5px 10px; width: 25%; font-weight: normal; text-align: center; color: " & $txtcolor & "; font: normal 700 24px/1 \"Calibri\", sans-serif; text-align: center; text-shadow: none;";
// End button style


"<div>" &
"<a " & $style & " href='" & $URLONE &"'>Update Info</a>" & "&nbsp;&nbsp;" &
"<a " & $style & " href='" & $URLTWO &"' target=\"new\">Print Record</a>" & "&nbsp;&nbsp;" &
"<a " & $style & " href='" & $URLTHREE &"'>Dealer Service Home</a>" & "&nbsp;&nbsp;" &
"<a " & $style & " onclick='DoSaveAdd()'href='#'>Save Record</a>" & "</div>"
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
See if this idea works

var text Edit = URLRoot() & "db/" & Dbid() & "?a=er&dfid=10";

var text ViewOnFormTen = URLRoot() & "db/" & Dbid() & "?a=dr&dfid=10&rid=" & [Record ID#];

var text URL = 
$Edit
& "&NextURL=" & URLEncode($ViewOnFormTen);

var text Words = "click here";

"<a href=" & $URL & ">" & $Words & "</a>"
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
That opened a fresh form. I don't need it to edit. The 'Update' button puts the form in edit mode. I just need it to save and display the correct form. Isn't there a way to amend the onclick='DoSaveAdd() so that it displays the current form upon save?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Sorry the first line was supposed to read

var text Edit = URLRoot() & "db/" & Dbid() & "?a=er&dfid=10&rid=" & [Record ID#];
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
But that's still an 'edit record' command. I'm not looking for the button to edit the record. I just want it to save it. The form is already in edit mode and has been edited. I just want to click a button that saves like 'onclick='DoSaveAdd() ', but I need it to stay on the same form. 
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
Or are you thinking I should edit the 'update' button?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
I'm suggesting that they use the edit button and then the regular save button will stay on the proper form.  I don't know how to change the DoSaveAdd button to force a particular form, so I'm offering up an alternative solution.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
yes, this would replace your update button.
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
Good call as usual, Mark... that worked!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
Thx for letting me know it worked.  I guess that you are still "stuck" with the native edit button at the top right, but that native Edit is pretty subtle compared to your row of matching buttons which look more inviting to click. 
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
Not entirely... I have reinstated the DoSaveAdd and retained my save button, and it works just as the native button does :) Win, win!
(Edited)
Photo of Jana

Jana

  • 324 Points 250 badge 2x thumb
Kelly...what was the final code that you implemented to make it work properly?  I'm trying to accomplish the same thing. :)
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
Remember, this is a row of navigation, so the one you want is 'Update Info' (bolded). 


// Begin button style
var text ViewOnFormThirtyOne = URLRoot() & "db/" & Dbid() & "?a=dr&dfid=31&rid=" & [Tracking#];
var text bgcolor = "#4b72b0";
var text txtcolor = "white";
var text URLONE = URLRoot() & "db/" & Dbid() & "?a=er&dfid=31&rid=" & [Tracking#];
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dbpage&pagename=" & URLEncode("Service Request Form.html") & "&clist=a&rid=" & [Tracking#];
var text URLTHREE = "https://vcommerce.quickbase.com/db/bnhjmd73w?";
var text URLFOUR = $URLONE & "&NextURL=" & URLEncode($ViewOnFormThirtyOne);
var text style = "style=\"text-decoration: none; background:" & $bgcolor & "; border-radius: 5px; padding: 10px 24px; margin-bottom:5px; width: auto; font-weight: normal; font-size: 12px; text-align: center; display: inline-block; color: " & $txtcolor & "; font: normal 700 24px/1 \"Calibri\", sans-serif;";
// End button style


"<div>" &
"<a " & $style & " href='" & $URLFOUR &"'>Update Info</a>" & "&nbsp;&nbsp;" &
"<a " & $style & " href='" & $URLTWO &"' target=\"new\">Print Record</a>" & "&nbsp;&nbsp;" &
"<a " & $style & " onclick='DoSaveAdd()'href='#'>Save Changes</a>" & "&nbsp;&nbsp;"
Photo of Jana

Jana

  • 324 Points 250 badge 2x thumb
Kelly this is amazing!  I wont lie, some/most is over my head but i can piece it together.  I'd love to mimic this if possible, but think i need a little hand holding if you dont mind?

To make sure i get it it, all of this code makes all four buttons your reference at the beginning of the post! My needs fairly close.

Upon saving, i want the user to return to Report 27 when sitting for Form 16. Currently they are being forced back to the original form, and i dont want that.  How can i that into your code?  I have little bits working but not all.  This redirects the user to report 27: 

URLRoot()  & "db/" & [_DBID_LEADERS2] & "?a=q&qid=27&nv=1&v0=" & [Record ID#];

Your URLTWO goes to Service Request, mine would go to the "A-Team Dashboard"...what would i put in place of what you have here:  URLEncode("Service Request Form.html"?

Then URLTHREE would just be my QB App i would assume?  And for other changes i would need to make...where you have Form 31, i put what form # the buttons are sitting on?  So Form 16 in this example and use [Record ID#] vs. [Tracking#]?

Thank you in advance!!
Photo of Jana

Jana

  • 324 Points 250 badge 2x thumb
Kelly...to help paint a clearer picture too, the below code works to get me to the report, however, i dont know how to add the SAVE function to it.  If you could help solve that issues, that would be more than enough for me as i'm sure you are busy.

// Begin button style
var text bgcolor = "#008522";
var text txtcolor = "White";
var text style = "style=\"text-decoration: none; background:" & $bgcolor & "; border-radius: 5px; padding: 10px 40px; color: " & $txtcolor & "; display: inline-block; font: normal 700 24px/1 \"Calibri\", sans-serif; text-align: center; text-shadow: none;";
// End button style


var text words="Save & Return to Change Leader Report";

var text url = URLRoot()  & "db/" & [_DBID_LEADERS2] & "?a=q&qid=27&nv=1&v0=" & [Record ID#];

"<a " & $style & " href='" & $url &"'>" & $words & "</a>"

Like i said..i need this to SAVE as well as redirect to the report.  

Thanks!

Jana
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
You might need to create a new post for this. I am not so fluent as to generate code without mixing and matching several combinations. Mark is a good one to ask, but I'd open it up to the form and see who jumps on it first :)