Results 1 to 3 of 3

Thread: Minimize Server Requests when Saving Form Progress

  1. #1
    Sencha User Trozdol's Avatar
    Join Date
    Jan 2009

    Default Minimize Server Requests when Saving Form Progress

    The Short Version:

    User has multiple customers, the customers have multiple cases, and the cases have multiple forms.

    The User can save at any point along the way when filling out customer case forms. This could mean too many requests if the user saves everytime they make a change.

    I want to save data/records to the store till the user is finished entering data. What is a good direction to take when saving to a store then after some event or user input, tells the store to update the server.

    SQLite is out for now.

    The long version...

    How it is now:

    Main.js                 // Ext.navigation.View
        AllForms.js         // Ext.carosel.Carosel
            Index.js        // Ext.Panel
            Form1.js        // Ext.form.Panel
            Form2.js        // Ext.form.Panel
            Form3.js        // Ext.form.Panel
            Form4.js        // Ext.form.Panel
            Form5.js        // Ext.form.Panel
            Form6.js        // Ext.form.Panel
            Form7.js        // Ext.form.Panel
            Form8.js        // Ext.form.Panel
            Form9.js        // Ext.form.Panel
    The above is an example of the relevant views. I've changed the names for clarification.

    When the AllForms.js gets 'Pushed' into the Main view the user then can swipe between forms filling out as needed then at any point tap the save button in a toolbar.

    Currently I getValues() on each form. Once all the values are collected they are merged into a single jSon object and sent to the Server for INSERT or UPDATE.

    Below is an example of the JsonP Request once the form fields have been combined into the
    values object shown below in params.
    // 'MyApp.controller.SaveFormsToServer'
        url: server + route,
        callbackKey: 'callback',
        params: values,
        success: function(response, request) {
            if (response.success) {
                Ext.toast('Saved Changes', 3000);
            } else {
                Ext.toast('Error: ' + response.message.code, 5000);

    This process happens for each save. The user could tap save for every form view the fill out or only once from one of them.

    I have a feeling that this is a bad approach as the stores primary use is getting records from the server for updating a list of customers. I only use it for that and getting a primary key to match customers to form data.

    How I think it should happen (I could be 1000% wrong in my thinking):

    I get the feeling that there is a more elegant solution to this. I am also worried that it would be a waste of a users data plan to make a bunch unnecessary requests when one would work just fine.

    The scope of the project doesn't allow for the developement of SQLite database and syncing that with the MySQL database. That's out of the question at least for this phase.

    Sometime ago I believe I ran across a Sencha demo that just saved data to the store. You could navigate the app and add records. I was thinking that might be a nice simple solution to mimizing requests and speed up the app also allowing for basic use if offline for a little bit of time.

    So My question really is...

    What would be a good way to save records to the store then update the server when the user is ready without SQLite? I'm open to using localstorage but I believe the example I saw didn't use that method.

    Where I'm really unsure is when syncing the store. Also controlling the routes recognized by the server so it knows to insert or update.

    Any suggestions are appreaciated. Thanks!

    FYI: I tried to stip out any info that would clutter this post, but if I forgot to mention something relevant I will be happy to clarify.
    Shayne Trosdahl

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    Why different forms and not a single form? When the form is valid then allow the submit?

    You can use a store to run this, there isn't anything that says it's bad. Each record in the store would have data for a single form.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User Trozdol's Avatar
    Join Date
    Jan 2009


    Thanks for responding!!

    The form is broken up into many sections. Each section is sort of independent in that you might not need to fill them out or you might need to leave and comeback later but allow others in a company to see what has been added so far and add to it if needed. These forms are also where the user goes enter, view, and edit the data.

    Is it possible to wrap a carousel in a form? Then any field inside would work with getValues()? I was thinking about this after the fact but time limited a test case.

    Maybe I am doing it wrong here but all the form questions live in one record in the database.

    So with the Store part of this am I...

    Taking the form values and add or update the record of the Store they come from?

    ...Then... on some event...

    Programmatically set the stores url to the route I need for insert or update instead of using the controllers JsonP Request?

    Hope that made sense.

    Sort of related: I saw in WebStorm when creating a new Model this comment that interested me.

    Doesn't this conflict with the stores purpose?

    Uncomment to add a rest proxy that syncs data with the back end.
    proxy: {
    type: 'rest',
    url : '/users'
    Shayne Trosdahl

Similar Threads

  1. Saving form to the server
    By odoakr in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 17 Sep 2012, 11:24 PM
  2. Saving form data to an XML file on the Server
    By rnfigueira in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 3 Aug 2012, 4:59 AM
  3. Using the PagingToolbar without requests to server?
    By anfla in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 17 Jul 2012, 2:31 AM
  4. HttpProxy requests abort others in progress
    By kilrae in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 8 Jul 2007, 12:49 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts