Forum Discussion

HunterB's avatar
HunterB
Qrew Cadet
2 years 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
    ------------------------------

14 Replies

  • This sounds like it might be an App, which is open to everyone on the Internet so they can apply for a job. If that is the case, and you are using new forms, you might want to consider enabling tabs and set it to work by steps. That will walk the user through step one step two step three step four in a logical sequence. It will also ensure that the data is saved on step one before it allows moving to step two.

    But you still have the problem that if a field is required on the form, it is not going to let you navigate away from that unsaved record to add children employment records if there are required fields on the parent form.  

    What you could do though is have step one on the form capture some information, then they would move to step two where they would add their employment information and then you could have a form rule that kicks in that when the number of employment records is greater than zero than you would require some fields on your step three part of the form.  

  • 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
    ------------------------------
    • 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
      ------------------------------

    • 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 Elite

        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");

  • AGinn1's avatar
    AGinn1
    Qrew Trainee

    Hi Chase,

    I'm going to try to use this on my form, but I wonder will this button work if I still have required fields further down the form or would I need to either unrequire them or use a form rule somehow to require upon/after the initial save?  Thanks for your help!

    Andrew

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      If you have required field record will not save. You can use a form rule to detect if the form is in Add mode by checking whether the date created is blank.  

  • AGinn1's avatar
    AGinn1
    Qrew Trainee

    Thanks Mark!  Could you flesh that out a little more for me?  I'm not totally tracking the Add mode or how that might affect it.  

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      Well, you have not really described your situation.  Are you trying to make a field be required in edit mode, but not the initial Add Mode when the record is being first created.

       If so, you can make a form rule that say when the [Date Created] is not blank, then require some fields.

  • AGinn1's avatar
    AGinn1
    Qrew Trainee

    This is an Applicant form for new applicants so several fields need to be required in Add mode.  I have an embedded Add Employment button, but you must satisfy required fields on parent record before employment button can be used.  is there a way to unrequire those fields until employment is added and save/continue is clicked?  I hope that makes sense.

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      Sorry, I still confused by your use case.  You are saying that you want fields on the parent record to be both required and unrequited at the same time.  Gotta run now, back after skiing today.

  • AGinn1's avatar
    AGinn1
    Qrew Trainee

    Sure thing...on Applicants form they enter all general employee data...then they click an embedded Add Employment button on the employment section that has the embedded report for all employment.  The issue is that further down the form there are other required fields preventing the embedded child Employment records from being saved until you fill in those required fields.  So they get warnings to go to this or that tab and it's confusing to them.  My question is is there any way to unrequire those fields further down the form and maybe use a form rule that makes them required ONLY after those child employment records are added.  I'm thinking it won't let me do that but that's what I'm trying to figure out.