Discussions

 View Only
Expand all | Collapse all

Create ""Save"" button that saves the record and then displays record in view mode

  • 1.  Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 14:23
    I want to create a simple "Save" button which saves the new record and then displays it in view mode.  Their doesn't seem to be an API command that does this.  This must be super simple, but I am not strong in the "code department.


  • 2.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 14:38
    this code as a formula Rich text field will make an extra save button to put on your form.

    "<a id='saveButton' class='Vibrant Success' onclick='DoSave()' href='#'>WhatEverYouWantYourButtonToSay</a>"

    The colors can be controlled by the words. Ignore the formula, I'm just showing you the colors available.  But I think that the success which used to be green got turned into blue when we had the purple day rebranding at Quick Base a few months ago.



    List("&nbsp;",
        "<a class='Vibrant'>Vibrant</a>", // regular grey button
        "<a class='Vibrant Alert'>Vibrant Alert</a>", // yellowish
        "<a class='Vibrant Danger'>Vibrant Danger</a>",  // red
        "<a class='Vibrant Primary'>Vibrant Primary</a>", // blue
        "<a class='Vibrant Snowy'>Vibrant Snowy</a>",  // white
        "<a class='Vibrant Success'>Vibrant Success</a>" // green




  • 3.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 14:50
    Thank you!  Works like a charm.  Now, what if I want to end up at the "view" mode of the record I just saved?


  • 4.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 14:52
    I don't understand. is the issue that you are landing back on a report after adding a record. Where are you landing that is a problem.  Where are you launching the Add Record from?


  • 5.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 15:13
    I am launching the "Add Record" from a Parent table (Properties) URL button to create the new child record "Work Order". 
    In "Work Order, I have placed my new save button. 
    When I click the new save button, I want to end up looking at the record that I just saved (rather than the Parent record from which it was created)



  • 6.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 15:48
    The fix is to change your ad child button. Can you post your code for at child and I�ll show you how to fix it.


  • 7.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 16:10
    URLRoot() & "db/" & [_DBID_WORK_ORDERS] & "?a=API_GenAddRecordForm&_fid_20=" & URLEncode ([Record ID#])& "&_fid_44=" & URLEncode([Address Code]) & "&z=" & Rurl()
    &"&_fid_236="& URLEncode(1)



  • 8.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 16:15
    No problem, just get rid of this.

    & "&z=" & Rurl()

    That will allow you to stick the landing like in gymnastics and stay right on the record that you just saved.


  • 9.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 14:40
    Yay!  works perfectly!  Okay, one more question and then I swear I am done - how do I use this button to ALSO change a field in the record I am about to save?  I have a fid #248 called "Type" which needs to be changed to the contain the text "Estimate" before the Save occurs.


  • 10.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 14:50
    URLRoot() & "db/" & [_DBID_WORK_ORDERS]
    & "?a=API_GenAddRecordForm&_fid_20=" & URLEncode ([Record ID#])
    & "&_fid_44=" & URLEncode([Address Code]) 
    & "&_fid_236="& URLEncode(1)
    & "&_fid_248="& URLEncode("Estimate")



  • 11.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 16:26
    I realize that this is what I would put in there if this were a formula-URL type field, but you original solution is for script that is used in a formula-rich text field (right?  this is how it is working now).  BUT, I need both of these things to happen when the one button is clicked:
    • fid 248 contents changes to "Estimate"
    • The new record is then saved
    Perhaps I am missing how what field type you are intending me to be using and how I can combine the two pieces of script:
    • "<a id='saveButton' class='Vibrant Success' onclick='DoSave()' href='#'>WhatEverYouWantYourButtonToSay</a>"
    • URLRoot() & "db/" & [_DBID_WORK_ORDERS]
      & "?a=API_GenAddRecordForm&_fid_20=" & URLEncode ([Record ID#])
      & "&_fid_44=" & URLEncode([Address Code]) 
      & "&_fid_236="& URLEncode(1)
      & "&_fid_248="& URLEncode("Estimate")





  • 12.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 16:31
    There is no need to use that extra save button, unless for some reason, having the green save button on both the top and the bottom of the form is not enough for your users and they need three!! save buttons on the form.

    The code I provided will launch the ADD record form and pre-populate fid 248 with "Estimate".


  • 13.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 17:11
    I do in fact need a button that does that.  At the bottom of the table, we want to make two different save buttons:

    Save as Work Order
    Save as Estimate

    I realize that we could manually choose one for the type field and then click save  - that would be the obvious thing to do.  I have had this sort of request before, so I figured I would try and see if you could feed me the code to make it happen.

    Are you saying that is can't be done within a single formula-rich text button?


  • 14.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-14-2018 18:11
    Sorry, I do not know if its possible to make an update to the form while saving.  I don't believe that it can be done without non native scripting.


  • 15.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 15:48

    Tarury, What you described is the default behavior of the add new record button that you see on the table home page. The URL behind it is db/<dbid>?a=nwr


    This is designed to save the new record and then open it in view mode.


  • 16.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 16:01
    Tauray

    Are you launching off a parent record to add a child or are you launching off the dashboard?


  • 17.  RE: Create ""Save"" button that saves the record and then displays record in view mode

    Posted 11-13-2018 16:12
    I am not launching off the dashboard - it must be created from the parent record.