Forum Discussion

HunterB's avatar
HunterB
Qrew Cadet
10 months ago
Solved

Add Save and Keep Working Button on form for a new record

Hello,

I would like to add a save and keep working button in the middle of my form. This would be used for new records that have yet to be saved before. Is that possible and how can I do it? I can get it to work for existing records but not new ones that haven't been saved yet.



  • There is a data-replaceRID component that you can place for new ones that QB will interpret and land you on the newly created record. This is an example of rich-text field using this: 

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


    var text link = "<a href='" & $url & "' data-replaceRid='true' style='font-size: 11pt;margin-left: 5px; margin-top: 0px; height: 33px; width: 160px; text-align:center;background-color:#13294d;color:white;background-image: linear-gradient(to bottom, #13294d 0%, #13294d 100%);' class='SaveBeforeNavigating Vibrant'>Save and Continue</a>";

    $link

    The two components are rid=%%rid%% in the url and then the data-replaceRID param in the button itself. 



    ------------------------------
    Chayce Duncan
    ------------------------------

5 Replies

  • There is a data-replaceRID component that you can place for new ones that QB will interpret and land you on the newly created record. This is an example of rich-text field using this: 

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


    var text link = "<a href='" & $url & "' data-replaceRid='true' style='font-size: 11pt;margin-left: 5px; margin-top: 0px; height: 33px; width: 160px; text-align:center;background-color:#13294d;color:white;background-image: linear-gradient(to bottom, #13294d 0%, #13294d 100%);' class='SaveBeforeNavigating Vibrant'>Save and Continue</a>";

    $link

    The two components are rid=%%rid%% in the url and then the data-replaceRID param in the button itself. 



    ------------------------------
    Chayce Duncan
    ------------------------------
    • Hongkunliang's avatar
      Hongkunliang
      Qrew Cadet

      Hi Chayce, thanks for the solution. If going further, is it possible to edit the new record within the URL? I tried  the following, but got the error message "Missing "rid" parameter"

      "URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=%%rid%%"

      &"&_fid_20="&URLEncode("Yes");

      Any suggestion?  Thanks in advance!

       

      • MikeTamoush's avatar
        MikeTamoush
        Qrew Commander

        Hongkunliang,

        Are you sure you were attempting this during an add record, and not during an edit record when the record was already saved? I think the %%rid%% may only work during the add record.Below will account for both scenarios.

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

        "URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & $RID

        &"&_fid_20="&URLEncode("Yes");

    • HunterB's avatar
      HunterB
      Qrew Cadet

      thank you so much, that worked perfectly. 



      Original Message:
      Sent: 07-17-2023 14:23
      From: Chayce Duncan
      Subject: Add Save and Keep Working Button on form for a new record

      There is a data-replaceRID component that you can place for new ones that QB will interpret and land you on the newly created record. This is an example of rich-text field using this: 

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


      var text link = "<a href='" & $url & "' data-replaceRid='true' style='font-size: 11pt;margin-left: 5px; margin-top: 0px; height: 33px; width: 160px; text-align:center;background-color:#13294d;color:white;background-image: linear-gradient(to bottom, #13294d 0%, #13294d 100%);' class='SaveBeforeNavigating Vibrant'>Save and Continue</a>";

      $link

      The two components are rid=%%rid%% in the url and then the data-replaceRID param in the button itself. 



      ------------------------------
      Chayce Duncan
      ------------------------------

      Original Message:
      Sent: 07-17-2023 14:19
      From: Catie Bruno
      Subject: Add Save and Keep Working Button on form for a new record

      Hello,

      I would like to add a save and keep working button in the middle of my form. This would be used for new records that have yet to be saved before. Is that possible and how can I do it? I can get it to work for existing records but not new ones that haven't been saved yet.



      ------------------------------
      Catie Bruno
      ------------------------------