Is it possible to create a "Save and Keep Working" button from a formula URL field?

  • 1
  • 7
  • Question
  • Updated 1 week ago
  • Answered
I realize the "Save and Keep Working" button was introduced by Quickbase, but I am wanting to add it somewhere in the middle of my form. I've seen posts relating to this kind of thing, but all of theme were published prior to the introduction of the "Save and Keep Working Button" and I can't seem to get any of them to work. Any thoughts?
Photo of ltduran

ltduran

  • 590 Points 500 badge 2x thumb

Posted 12 months ago

  • 1
  • 7
Photo of Chad Brandmire

Chad Brandmire

  • 968 Points 500 badge 2x thumb
Try this in a Formula Rich Text

var text urlone = URLRoot() & "db/" & [_DBID_TABLE_1] & "?a=dr&dfid=2&rid=" & URLEncode([Route ID#]);

"<a href="& $urlone &"><img width=\"100\"src=\"<i><u>Link your button image here</u></i>\"></a>";
Photo of ltduran

ltduran

  • 590 Points 500 badge 2x thumb
Hi Chad,

Thanks for your response. I just tried this and perhaps I'm doing something wrong, but this is saving the record, but then opening the form in view mode; as opposed to saving and reopening edit mode. Any thoughts?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 50,798 Points 50k badge 2x thumb
Try changing

a=dr

to

a=er
Photo of ltduran

ltduran

  • 590 Points 500 badge 2x thumb
I tried this as well, but now I'm noticing that regardless of whether it is dr or er, it doesn't save any of the data entered into the form prior to pressing the button. All it is doing is reopening the form in either view or edit mode, as opposed to saving and reopening the edit form.

My code is as follows:

var text urlone = URLRoot() & "db/" & [_DBID_GAMES] & "?a=er&dfid=2&rid=" & URLEncode([Record ID#]);

"<a href="& $urlone &"><img width=\"100\"src=\"<i><u>https://cdn.maxbuttons.com/wp-content/themes/maxbuttons-theme/images/icons/basic-buttons-pack.png<...;
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 50,798 Points 50k badge 2x thumb
I do not have a solution for you.
Photo of ltduran

ltduran

  • 590 Points 500 badge 2x thumb
Alright, thank you anyway. I appreciate it.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb
Put a Rich Text Formula field in the middle of your form with this definition:

"<div style='Vibrant Success' onclick=$('#footerSaveAndKeepWorkingMenuOption').click();>Save and Keep Working</div>"

When it is clicked it will trigger the clicking of the native Save and Keep Working button (even though it is not visible at the moment).  FWIW, this type of strategy of embedding JavaScript into a form which emulates a user clicking on a native features is safer than other methods of more directly invading the native markup and code.
Photo of [none]

[none]

  • 130 Points 100 badge 2x thumb
Ok thanks.  I tried to add a New field in a completely different application and paste it in there...and it doesn't work there either.  I'll putter around and see what I can come up with...I'll let you know if it gets solved.  
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb
So you have this option "Show save & keep working" selected?

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb
BTW, the formula should use class not style:

"<div class='Vibrant Success' onclick=$('#footerSaveAndKeepWorkingMenuOption').click();>Save and Keep Working</div>"

It will show up as Blue since the purple rain release.

Photo of [none]

[none]

  • 130 Points 100 badge 2x thumb
Ok...that's embarrassing.  I forgot the form setup does not automatically default to Save and Keep Working.  That has to be done before trying this awesome formula out.  Very sorry for wasting your time...thanks again.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb
No problem - I have to answer a number of mundane questions like this so the forum censor does not wholesale delete my more radical posts dealing with QuickBase customization and scripting  (which reveal awesome new capabilities and the future of Quickbase) and my favorite pastime of decoding the Voynich manuscript
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,486 Points 50k badge 2x thumb
Wow, I will need to try that trick myself.
Thx for the Boxing week Christmas Present. 
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,572 Points 20k badge 2x thumb
Well I have a truckload (100s) of similar techniques for which I just need a kitschy name, an image macro or some other gimmick in order to promote the technique. Just get me the raw concept and I will get you the technical solution. Something creative like this:


Photo of QB Development

QB Development

  • 330 Points 250 badge 2x thumb
This works great. But, how can I activate the Save & keep working feature from the header? Using "onclick=$('#saveButton')" as mentioned above activates the normal save function which I've set to redirect to an error message because I have created my own own 'save' and 'apply changes' buttons
And, using  "onclick=$('#footerSaveAndKeepWorkingMenuOption')" only works if the footer is added to the form. I'd prefer not to have it there.
Photo of Chad Brandmire

Chad Brandmire

  • 938 Points 500 badge 2x thumb
#saveAndKeepWorkingMenuOption
Photo of QB Development

QB Development

  • 330 Points 250 badge 2x thumb
Got it! Thanks!
Photo of Alex Wilkinson

Alex Wilkinson

  • 1,006 Points 1k badge 2x thumb
Here's a cleaner way to do this, replicating the color and style of the standard 'Save & keep working button' while allowing it to be placed anywhere on the form:

1) In the form properties, check the box to "Show save & keep working choice." (It's not necessary to also check the box to show the save and cancel buttons at the bottom of the form. That's optional.)

2) Create a global variable for your app at Setting >> Variables ... Let's say you call it "mySaveKeepWorking" or something similar ... and give it exactly the following value (the quotes are critical!)

<a class='Vibrant' style='font-size:14px; color:white; background:#6BBD57; white-space:nowrap;' onclick='$("#saveAndKeepWorkingMenuOption").click();'>Save & keep working</a>

3) In your table, create a rich text variable ... say it's called "mySKW" and give it exactly and only the following value:

[mySaveKeepWorking]

4) In your form, place the mySKW field wherever you want, as often as you like. Each time, be sure to check the box for "Use Alternate Label Text" while leaving the value blank, and to set the form-row for "edit and add" modes.

When you save the form, Quick Base will ask you to confirm that you really do want the mySKW field to appear multiple times, which you do!

That's it. One wrinkle: it might be nice to have mySKW return to the same spot on the form where it was clicked. That's doable but a bit fancier. Post back here if interested.
(Edited)
Photo of Alex Wilkinson

Alex Wilkinson

  • 1,006 Points 1k badge 2x thumb
Yes. You could make three global variables, one for each of the possible values on the drop-down in the standard green save button.

the field "mySC" would use [mySaveClose] which would have #saveMenuOption

the field "mySN" would use [mySaveNext] would have #saveAndNextMenuOption

... instead of #saveAndKeepWorkingMenuOption ... otherwise everything is identical.

Quick Base could change these, of course, but that seems low-probability for now. You can find them by using the developer tools in your browser to inspect the source code for a page, and doing ctrl-F for "#save" ...
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,242 Points 20k badge 2x thumb
> You could make three global variables,

The browser creates these global variables automatically. All you have to do is use them!

This part of my message may have been clipped:

This can be applied to Mark's inquiry as well. These two fragments are essentially equivalent:
<a class='Vibrant' style='font-size:14px; color:white; background:#6BBD57; white-space:nowrap;' onclick='$("#saveButton").click();'>Save & Nothing More</a>

<a class='Vibrant' style='font-size:14px; color:white; background:#6BBD57; white-space:nowrap;' onclick='saveButton.click();'>Save & Nothing More</a>
This technique comes in handy when referencing fields on new and edit forms. Instead of this:
$("_fid_6")[0]
or
document.getElementById("_fid_6")
you can just use this:

_fid_6
Photo of Alex Wilkinson

Alex Wilkinson

  • 1,006 Points 1k badge 2x thumb
Haven't tested the 'Save & Nothing More' idea, but looking at the HTML, I am wondering if it will do Save & close OR Save & next OR Save & keep working ... depending on what the user last selected from the save button menu ??? (Save & close would be the default, if the user had never selected another option.)
Photo of Hector A.

Hector A.

  • 104 Points 100 badge 2x thumb
have mySKW return to the same spot on the form where it was clicked. That's doable but a bit fancier. Post back here if interested.

I'm interested in this
Photo of zvi bock

zvi bock

  • 200 Points 100 badge 2x thumb
Could you please let me know how you get it back to the same spot? I am very much in need of that behavior