facebook

Out of sequence SubmitForm Processing

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #341383 Reply

    Hello Support,

    As I am struggling with my program execution problems, I have encountered another instance where MOBI might be having a problem: phoneui.submitForm(<formname>);

    I am enclosing a printout of the console.log where I have captured the execution sequence of the processing for one of my functions.
    I have inserted prints to capture the sequence of events with time stamps.

    The problem has to do with the processing sequence for a program issued phoneui.submitForm() statement. I would think that the sequence would be to process my preSubmit, then submit the form, followed by my postSubmit code. And then execute the next code in line in the function.

    In a normal situation, the console displays below should be in sequential order. However, as you can see the postForm processing logic ( Sequence# 3 and 4) does NOT get executed until way after the routine has executed my function call. I am setting values in the postSubmit and these are used in the subsequent logic. And since the postSubmit has not executed yet when the submitForm() returns, it causes all kinds of processing problems for my subsequent logic.

    I am emailing the MOBI and Custom.JS codes in an email with subject: TURGUT – Out of sequence SubmitForm Processing

    To replicate the problem follow this process:
    – Select “Run in Test Center”
    – Open console log area
    – Type in: localStorage.clear();
    – Press either F5 or Right-click RELOAD

    You should see the same output I have included below, plus some more that I have deleted.

    This happens in MOBI23, MOBI25 M1 w/ Cordova 2.2 and 2.9. Also in all IOS selections in the test center.

    I have also included a TestFormPreNPost.mobi program that demonstrates the same thing.

    Please take look and let me know I am not losing my mind. I can expect certain kinds of bugs in a system like MobiOne, but something as fundamental as this one is a bit over the top. Not to mention it has been causing me to chase my own tail for days now. I am slowly losing confidence in the product.

    Thanks, TG

    CONSOLE LOG printouts:

    FROM MOBI23:

    iASC_custom.js:843 0 – ENTERING Set Option: 1376061057765
    iASC_custom.js:854 1 – BEFORE Form send: 1376061057766
    iASC_custom.js:975 2 – INSIDE Form preSubmit: 1376061057769
    iASC_custom.js:859 5 – AFTER Form send: 1376061057779
    iASC_custom.js:863 6 – BEFORE Set Option Defaults: 1376061057779
    iASC_custom.js:884 Setting OPTIONS to DEFAULTS.
    iASC_custom.js:866 7 – AFTER Set Option Defaults: 1376061057781
    jquery-1.8.3.js:8434 XHR finished loading: “http://bakery-z.com/opt?&_=1376061057777&#8221;.
    iASC_custom.js:995 3 – ENTERING Form postSubmit: 1376061059131

    … deleted some local displays

    iASC_custom.js:1059 4 – EXITING Form postSubmit: 1376061059139

    ========================================================

    FROM MOBI 2.5M1 with Cordova 2.2:

    0 – ENTERING Set Option: 1376058811237 iASC_custom.js:843
    1 – BEFORE Form send: 1376058811238 iASC_custom.js:854
    2 – INSIDE Form preSubmit: 1376058811239 iASC_custom.js:975
    5 – AFTER Form send: 1376058811245 iASC_custom.js:859
    6 – BEFORE Set Option Defaults: 1376058811245 iASC_custom.js:863
    Setting OPTIONS to DEFAULTS. iASC_custom.js:884
    7 – AFTER Set Option Defaults: 1376058811246 iASC_custom.js:866
    GET file://tgdtw7-srv/resources/demos/style.css iASC.html:23
    navigator.network.connection is deprecated. Use navigator.connection instead. cordova-2.2.0.js:335
    navigator.network.connection is deprecated. Use navigator.connection instead. cordova-2.2.0.js:335
    navigator.network.connection is deprecated. Use navigator.connection instead. cordova-2.2.0.js:335
    XHR finished loading: “http://bakery-z.com/opt/?_=1376058811244&#8221;. jquery-1.8.3.js:8434
    3 – ENTERING Form postSubmit: 1376058812214 console.js:19
    3 – ENTERING Form postSubmit: 1376058812214 cordova-2.2.0.js:5248

    … deleted some local displays

    4 – EXITING Form postSubmit: 1376058812234 console.js:19
    4 – EXITING Form postSubmit: 1376058812234 cordova-2.2.0.js:5248

    ========================================================

    FROM MOBI 2.5M1 with Cordova 2.9:

    0 – ENTERING Set Option: 1376060727695 [VM] cordova-2.9.0.js (963):5638
    1 – BEFORE Form send: 1376060727696 [VM] cordova-2.9.0.js (963):5638
    2 – INSIDE Form preSubmit: 1376060727697 [VM] cordova-2.9.0.js (963):5638
    5 – AFTER Form send: 1376060727704 [VM] cordova-2.9.0.js (963):5638
    6 – BEFORE Set Option Defaults: 1376060727705 [VM] cordova-2.9.0.js (963):5638
    Setting OPTIONS to DEFAULTS. [VM] cordova-2.9.0.js (963):5638
    7 – AFTER Set Option Defaults: 1376060727706 [VM] cordova-2.9.0.js (963):5638
    GET file://tgdtw7-srv/resources/demos/style.css iASC.html:989
    XHR finished loading: “http://bakery-z.com/opt/?_=1376060727703&#8221;. jquery-1.8.3.js:8434
    3 – ENTERING Form postSubmit: 1376060728992 [VM] cordova-2.9.0.js (963):5638

    …deleted some local displays

    4 – EXITING Form postSubmit: 1376060729005 [VM] cordova-2.9.0.js (963):5638
    deviceready has not fired after 5 seconds. [VM] cordova-2.9.0.js (963):5638
    Channel not fired: onCordovaConnectionReady [VM] cordova-2.9.0.js (963):5638

    Attachments:
    You must be logged in to view attached files.
    #341386

    Unknown Author
    Participant

    You may be hitting up against the fact that JavaScript uses multithreaded execution. If you need certain things done in order, you may need to recursively wait for event 1 to finish before allowing event 2 to start.

    -1TC

    #341402

    1TC,

    That sounds real good. But I have no control of the phoneui.SubmitForm(). It is an instruction that I issue that in the phoneui.js happens to have three parts to it: preSubmit() – works OK, submit() – works OK, postSubmit() – executes delayed. Also, keep in mind that if I used the onClick – formSubmit of the MOBIone design center, everything works correctly. Unfortunately I cannot use that in this case as I am doing things behind the scenes invisible to the user.

    I tried putting a while loop as a delay before my next instruction but that does not work either; because it delays the execution of the postSubmit() to after the loop.

    I tried intercepting the ‘end of execution’ of the postSubmit() with no success as it returns to phoneui.js and not my program.

    If there is a magic code that you know about, I would be much obliged if you shared it. I am not an experienced JS coder, so I am sure that there might be tricks around this issue. However, I was not able to discover it in all my searches.

    Open to any and all suggestions – desperately waiting.

    >> Support – any comments?

    TG

    #341429

    support-michael
    Keymaster

    As you have identified the phoneui.submitForm() function is called by the Visual Designer’s “Submit Form” action that can be attached to widgets such as buttons. This function will run asynchronously as it executes the basic form submission process asynchronously (ajax call). The postSubmitForm_XXX() is called upon completion of the basic form submit.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Out of sequence SubmitForm Processing

You must be logged in to post in the forum log in