Discussions

 View Only
  • 1.  Auto-Save

    Posted 05-09-2022 02:21
    Is there a way to trigger an auto-save event after a certain field on a form is filled and then have the same record stay open for continued edit.
    Kind of like how the autosave occurs for the parent when entering a child record.

    ------------------------------
    Steven Nelson
    ------------------------------


  • 2.  RE: Auto-Save

    Posted 05-09-2022 07:28
    The user can either click on the option to save and keep working which is an option on the green save button which you can enable on the form properties, or else the user could push a button to save and keep working. 
    But I don't think it's possible to trigger an auto save based on the user entering data in certain fields.

    Feel free to post back if you need help with a button which will save and continue editing.


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Auto-Save

    Posted 05-09-2022 21:52
      |   view attached
    Here is some detail, Maybe you can tell me whats wrong with the code.
    Keep in mind I am a bit of a beginer at this.

    I have a parent table that users make an entry for requests.  There are a few child tables associated with it that they may or may not need to add info into.
    I have a notification that is sent out once the entry is made, but I had issues with it including the child info or sending the notification everytime each piece of child info was entered (obviously dont want multiple notifications on one entry).  So, I hid the save button, created a Submit button.  When the user clicks the submit button after everything is entered, it redirects to a page that asks for one last piece of information and saves the entry and sends the notification.  I had the notification look for that final piece of info before sending.  Problem is that if no child info is needed, therefore the record hasnt been saved once already, for some reason it will not add the final piece of info.  I guess I am telling it to edit when there is nothing to edit yet because the record hasnt been saved.

    Below is the submit button formula
    Attached is the Code Page.

    Submit Button
    // API URL to Add/Edit/etc.
    var text urlToExecute = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord"
    & "&rid=" & [Record ID#]
    & "&_fid_11=" // Field to Popuplate with the user prompted input
    ;

    URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=3" // Open code page 3
    & "&url=" & URLEncode($urlToExecute) // Pass in the URL to execute

    ------------------------------
    Steven Nelson
    ------------------------------

    Attachment(s)

    rtf
    Page.rtf   47 KB 1 version


  • 4.  RE: Auto-Save

    Posted 05-10-2022 08:45
    Edited by Mark Shnier (Your Quickbase Coach) 05-10-2022 22:59
    I can't help you with your code page approach, seems too complicated for my style.

    I suggest making a button which will update a date time field to the current date time to act as a Submit trigger for a notification.  So rather than triggering on "that last piece of data", just have the user click to Submit when they are ready.

    If you need the Submit button to also work in Add mode it does get a bit more complicated as normally API_EditRecord needs to act on a Saved record.  But we can use a formula Rich Text button to also work in Add mode.

    This not tested but might work to save the record and redisplay it to the user regardless of the user is in Add mode or Edit mode.

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

    var text EditRecord = URLRoot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&apptoken= xxxxxx" // if you have the need for Application Tokens enabled.
    & "&rid=" & ToText($RID)
    & "&_fid_99=now"; // set field ID 99 to the current date time to trigger Notification,. 

    var text DisplayRecordButMissingRID = URLRoot() & "db/" & dbid() & "?a=dr&rid=";

    var text URL =
    $EditRecord
    & "&rdr=" & URLEncode($DisplayRecordButMissingRID) & $RID; // the %%RID%% does not like being URLEncoded.

    "<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #1ba802; border-radius: 5px; color: #ffffff; display: inline-block; padding: 2px 2px 2px 2px; width:200px; text-align: center; text-shadow: none; border: 2px solid #1ba802; font-size: 18px \"href='"
    & $URL
    & "'>Submit</a>"


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Auto-Save

    Posted 05-10-2022 10:36

    Mark,

    What does this part do?

    'data-replaceRID=true'



    ------------------------------
    Mike Tamoush
    ------------------------------



  • 6.  RE: Auto-Save

    Posted 05-10-2022 11:24
    It's the code required to first save the record, get the newly created Record ID# and substitute it into the URL where we use %%RID%% placeholder.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: Auto-Save

    Posted 05-10-2022 22:29
    Thanks, Mark
    I implemented your suggestion and tested, works perfect.

    ------------------------------
    Steven Nelson
    ------------------------------