Discussions

Expand all | Collapse all

Allow users to save and close a form on another page without leaving current form?

  • 1.  Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 11:28
    Edited by Jeff Peterson 09-23-2020 11:35
    I have a form where the users fill in some info,  then click a button called 'add dispatch'.     currently, the button takes them to another table where they must use the green save and close button, then they are left there in view mode.

    How would I write this to make it so that they can add the record, save, close and either return to or stay on the originating page?

    Here's the code I currently have:

    var bool noRepSelected = If(Trim([Field Rep - Name])="", true);
    var bool noScheduleDate = IsNull([Schedule Date]);
    var bool noAppTemplate = If(Trim([App Template - Template Name])="", true);
    var bool activeDispatch = If([Active Dsps]=0, false, true);
    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Item #]);


    If($noRepSelected=true or $noScheduleDate=true or $noAppTemplate=true or $activeDispatch=true,"",$dispatchButton)

    Any help is appreciated!

    ------------------------------
    Jeff Peterson
    ------------------------------


  • 2.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 12:52
    try this


    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Item #]) & "&z=" & Rurl();

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 13:12
    It still takes me to the Dispatches Table where  I must click 'Save & Close' (once I do this I'm returned to the parent record though).  Is there a way to do this without the user even leaving the parent record?

    ------------------------------
    Jeff Peterson
    ------------------------------



  • 4.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 13:15
    Are you asking if you can have a separate little pop up window to add the dispatch and then that pop up would close when you save the dispatch?

    if so, the answer is "no", it would be nice to have that functionality, but we do not have that functionality at this time.  You would need to put tat into a UserVoice suggestion.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 13:23
    No, we shouldn't even need a pop-up.  

    Basically,  the question is:  Can the 'Save & Close' button function on the dispatches table be built into this 'Add Dispatch' button, so the user isn't being taken to another form to have to click 'Save & Close' before being returned?  Essentially, making a 2 click process 1 click?

    ------------------------------
    Jeff Peterson
    ------------------------------



  • 6.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 13:30
    Sorry, I'm not understanding your desired workflow.  But before I ask my question have you considered allowing the uses to just create Dispatch record(s) in grid edit mode on the parent table? have an embedded table of dispatches and make the form property for the embedded  reports to be editable and they can enter a parent and the child record(s) dispatches on the same form and Save in one Save click and also avoid the Add Dispatches button.

    You seem to have a lot of conditions on when you show that button.  You would need perhaps to use a similar formula field called [Show dispatches Grid Edit?] in a Form Rule, to show/hide that grid edit embedded report.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 13:53

    I'm just trying to remove a click from the current workflow which looks like this:

    1.  Service request is entered on Site Visits table.
    2.  Our users add some info and verify some other fields are correct.
    3.  Our users click ' Add dispatch ' button. 
    4.  They are shown the new record on the 'Dispatches' table.
    5.  They click 'Save & Close'
    6.  They are redirected back the original record on the 'Site Visits' table.

    What I'm trying to do is remove 4 and 5 from the list above from the workflow.  I'd like them to be able to just click 'add dispatch' and remain on that record to create the new record in the 'dispatches' table and not have to got there to view the record and click 'Save & Close'. 

    We probably wouldn't do this via grid edit as there is a lot of info contained in these records that needs to be verified,  so they are best done individually.

    The conditional rules on the button visibility are to protect against double dispatches and dispatches that are missing info being created accidentally (this works perfectly)





    ------------------------------
    Jeff Peterson
    ------------------------------



  • 8.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 14:00
    Wow, we are still  not understanding each other.  To add a Dispatch does data need to be entered by hand that only the user knows in their Mind?  If so, I'm not understanding how you propose to capture the data from their Mind into  a record without landing the user on an Add Dispatch form.  What am I missing?

    Unless, in fact there is no data entry required and you just want to add a child record by clicking a button as opposed to landing the user on an Add Record Form.  ie you wanted to use API_AddRecord.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 9.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 14:32
    Edited by Jeff Peterson 09-23-2020 14:34
    Sorry for the confusion,  I'm not a veteran QuickBase user and I'm still learning, so I may be wording things incorrectly.   

    SiteVisitform:


    All of the data entry happens on the 'site visits' form.  (user chooses a technician,  a schedule date, etc.) so yes,  the data entry is from the mind of the user and is entered by hand,  but via this 'site visits' form.   Then they click 'add dispatch' and they see the output that will be added to the dispatches table via another form 'dispatches main form'.   

    This is the form they land on after clicking 'add dispatch'.    They don't need to do anything here, data-entry wise, the necessary data has already been entered.  Here is where they only have to click 'Save & Close'.       I'm wanting to eliminate this step for the users.   I want them to only have to click 'add dispatch' in the originating form to create the dispatch,  instead of having to view this form and click 'save & continue' to return.    

    I hope that explanation makes more sense,  my apologies if not.


    ------------------------------
    Jeff Peterson
    ------------------------------



  • 10.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-23-2020 18:24
    OK, now I understand.  you want to actually create a record and not put up an Add Record form.  You are telling me that in fact here is no data to be entered On the form, just connectIng it to the Parent and everything else will come down as lookup fields.

    You are also saying that you want to create this child record when the parent is in edit mode and maybe add mode too.

    You have an unusual situation where you have a child record to be entered which requires no data entry.  
    If you are sitting on a Service Request record in edit or add mode and have the grid edit report of dispatches, then if you make a checkbox field on the dispatches table and call it [Create Dispatch] , then in grid edit mode the user can click the a checkbox and when the Parent Service Request is saved, it will create a Dispatch record.  You need to make the embedded report grid editable in Form Properties.

    If you would prefer to have a button which will clicked in edit or view mode to create the dispatch and then redisplay the record, then this will  probably work if you set the table advance properties to save record automatically as pushing the button will cause the record to save.

    This will only work in edit or view mode so you would need to hide the button in add mode.


    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]) 
    & "&rdr" & URLEncode(URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#])
    .




    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 11.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-24-2020 11:44
    OK,  
    So the function works,  I'm getting xml code indicating success, but not getting redirected back to the original form.  Any ideas?

    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]) 
    & "&rdr" & URLEncode(URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Item #]);

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <qdbapi>
    <action>API_AddRecord</action>
    <errcode>0</errcode>
    <errtext>No error</errtext>
    <rid>62275</rid>
    <update_id>1600961230995</update_id>
    </qdbapi>


    ------------------------------
    Jeff Peterson
    ------------------------------



  • 12.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-24-2020 11:57
    sorry, typo missing an equals sign after the rdr so the redirect failed.

    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]) 
    & "&rdr=" & URLEncode(URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Item #]);

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 13.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 09-24-2020 17:03
    Worked like a charm,  thank you!!

    ------------------------------
    Jeff Peterson
    ------------------------------



  • 14.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 27 days ago
    Mark,

    Is it possible to also have this button change 2 other fields in this form?   

    I want it to change a drop-down field to 'Dispatched' and to enter the date and time into a field called 'dispatched date'.    

    Thanks for your help!

    ------------------------------
    Jeff Peterson
    ------------------------------



  • 15.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 27 days ago
    Edited by Mark Shnier (YQC) 26 days ago
    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord"
    & "&_fid_7=" & URLEncode ([Item #]) 
    & "&_fid_8=" & URLEncode ([other field]) 
    & "&_fid_9=" & URLEncode ([other other field]) 

    & "&rdr=" & URLEncode(URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Item #])

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 16.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    Hmm doesn't seem to work.    Any idea where my error is here?   

    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]
    & "&_fid_25=Dispatched"
    & "&_fid_97=" & URLEncode(Now())

    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Item #]);


    ------------------------------
    Jeff Peterson
    ------------------------------



  • 17.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    Edited by Mark Shnier (YQC) 26 days ago
    Try this

    URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]
    & "&_fid_25=Dispatched"
    & "&_fid_97=" & URLEncode(Now())

    & "&rdr=" & URLEncode(URLRoot(& "db/" & Dbid() & "?a=dr&rid=" & [Item #])


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 18.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    The page reloads but nothing happens at all if I add those 2 lines.   Here's the whole snippet:

    var bool noRepSelected = If(Trim([Field Rep - Name])="", true);
    var bool noScheduleDate = IsNull([Schedule Date]);
    var bool noAppTemplate = If(Trim([App Template - Template Name])="", true);
    var bool activeDispatch = If([Active Dsps]=0, false, true);
    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]
    & "&_fid_25=Dispatched"
    & "&_fid_97=" & URLEncode(Now())
    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Item #]);


    If($noRepSelected=true or $noScheduleDate=true or $noAppTemplate=true or $activeDispatch=true,"",

    "javascript:" &
    "$.get('" & 
    $dispatchButton & 
    "',setTimeout(function(){" &
    "location.reload(true);" &
    "},1000));" 
    & "void(0);")


    ------------------------------
    Jeff Peterson
    ------------------------------



  • 19.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    if you are using the javascript to reload the page, then you do not want to have the rdr=

    var bool noRepSelected = If(Trim([Field Rep - Name])="", true);
    var bool noScheduleDate = IsNull([Schedule Date]);
    var bool noAppTemplate = If(Trim([App Template - Template Name])="", true);
    var bool activeDispatch = If([Active Dsps]=0, false, true);
    var text dispatchButton = URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]
    & "&_fid_25=Dispatched"
    & "&_fid_97=" & URLEncode(Now());


    If($noRepSelected=true or $noScheduleDate=true or $noAppTemplate=true or $activeDispatch=true,"",

    "javascript:" &
    "$.get('" & 
    $dispatchButton & 
    "',setTimeout(function(){" &
    "location.reload(true);" &
    "},1000));" 
    & "void(0);")


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 20.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    I get the same result if I remove the rdr line.  The button does nothing.  The screen refreshes but no actions happen.

    ------------------------------
    Jeff Peterson
    ------------------------------



  • 21.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    That javascript refresh will hide any error messages.

    Let's check what the URL alone does

    Can you try this as a stand alone URL formula field to see what it does

    URLRoot() & "db/" & [_DBID_DISPATCHES] & "?a=API_AddRecord&_fid_7=" & URLEncode ([Item #]
    & "&_fid_25=Dispatched"
    & "&_fid_97=" & URLEncode(Now())


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 22.  RE: Allow users to save and close a form on another page without leaving current form?

    Posted 26 days ago
    OK,  so I can see that we're trying to edit fields on the wrong table.   Field 25 is called 'status' on the table I want to update.

    <qdbapi>
    <action>API_AddRecord</action>
    <errcode>34</errcode>
    <errtext>You cannot change the value of this field</errtext>
    <errdetail>The field named "SV - Instructions" with field id 25 cannot be modified</errdetail>
    </qdbapi>

    ------------------------------
    Jeff Peterson
    ------------------------------