facebook

onclick function too sensitive

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

    Hi JohnJake2,

    We have an open bug for this thread but have not been able to create any test cases that result in a button receiving fantom taps/clicks.

    What version of mobione are you using?

    I am wondering if perhaps multiple calls to preprocessDOM() on the same DOM subtree is registering redundant event handlers or something like that. I know we fixed such a problem a while back. Can you share a link to your webapp for us to investigate? you can send it to support at genuitec dot com if you want to keep data in privacy

    #335646 Reply

    JohnJake2
    Member

    Hi support-octavio.
    Yes, I can provide a link but since it is data of a customer, I wouldn’t like to post it here. How can I send you a personal message?
    JohnJake.

    #335669 Reply

    @JohnJake2,

    You can send us the URL to our support email: support at genuitec dot com. Thanks

    #335714 Reply

    JohnJake2
    Member

    Hi support-octavio.

    I have made some more checks and it might be that the prompt() function causes the problem. Just as a test a created a new project, added a button and a new function that prompts the user for a password. It is not as extreme as in my other app, but every second try you get the password-prompt at least two times.

    You may also check this web app by using the url that I sent you yesterday. Just replace …/octavio/Main.html by …/octavio2/ButtonTest.html
    (I removed the other project since testing with this sample is more easy and not customer-data related).

    Thx in advance for your investigation.
    JohnJake2

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

    Hi JohnJake2,

    I’ve tested your web app and the project you shared, but I only got once the double prompt. Can you tell me the device(s) that you used to test these sample designs?

    #335829 Reply

    Unknown Author
    Participant

    I had this problem too. Havent gotten a workaround. As you told me, leave it to the experts donij.

    #335833 Reply

    JohnJake2
    Member

    Hello support-octavio.

    I am still mainly using the iPhone4S (like mentioned above). After having reduced the code to this little example, I had two testing devices with exactly the same problem. After having finishing the sending test button app to you, the iPhone 4S showed up the password dialog several times. But I think this was cached from the former code. After deleting and reinstalling the app, I only get the dialog 2 times (exactly like you).
    Since alert() or phoneui.alert() functions just pop up only once (like expected) I am still convinced that there is a timing-/event problem with the prompt function. Also I am wondering why support-wayne mentioned that there is no or will be no poneui.alert function. I assume that such a function would ease my pain! 😉

    More code behind the function that is called, obvously leads to more and more repeat times. My original web app (much code right after the password dialog) now shows this behavoiur: First click on the button sometimes leads to no effect, sometimes just one event. The next time, it will be 2 events fired, then 3, then 6, then 12, then 24 and then 48. Terminating and restarting the web app always(!! [and this is new!]) leads to the same behaviour. After 3 events fired, it will always be 6, 12, 24 and 48!
    I have been going through my code several times and could not find a problem. I used phoneui.preprocessDOM(‘myProject-form…’) quite often since I had the problem that my phoneui.showActivityDialog(“Loading data…”) did not show up while loading data. Only when the function stopped in order to show an error, my “loading data” dialog was visible, even I used phoneui.hideActivityDialog() right in the error handler. 🙁 But after taking off any of these dialog elements and all preprocessDOM lines in order to find the error, I removed them all but the occurrences of my button click event did not change…

    To sum it up: I think, there is a problem with the internal implementation or handling of the prompt function. This little test app you have downloaded and tested just leads to one or two events fired when pressing the button. But already two events fired is at least one to much. 😉 Can you use this sample to find out why the function is triggered more than once. You are now able the reproduce the rpoblem….

    Thx in advance for your support.
    JohnJake2

    #335840 Reply

    support-michael
    Keymaster

    >Also I am wondering why support-wayne mentioned that there is no or will be no poneui.alert function. I assume that such a function would ease my pain! 😉

    hmm! I don’t recall such comment. I might have indicated that alert() can lead to inaccurate state info if used for async activities. I prefer to use console.log(“msg”) which prints to the javascript console. There is phoneui.alert() functionality as follows:

    /**
     * Display an alert dialog, calls fnContinue when closed. 
     * The styling parameters are only recognized when used in native app. 
     * On mobile web browser the standard blocking javascript alert dialog rendered.
     * On native app the blocking Cordova/PhoneGap alert dialog is rendered.
     * On test center a non-blocking custom dialog is rendered.
     * 
     * @param {string} message  Display text
     * @param {function} [fnContinue]  Callback invoked when dialog is dismissed
     * @param {string} [title]  Dialog title
     * @param {string} [buttonLabel]
     */

    >To sum it up: I think, there is a problem with the internal implementation or handling of the prompt function. This little test app you have downloaded and tested just leads to one or two events fired when pressing the button. But already two events fired is at least one to much. 😉 Can you use this sample to find out why the function is triggered more than once. You are now able the reproduce the rpoblem…

    I will look into this later today. I am assuming that you are referring to using the ButtonTest.zip and that it is up to date for testing, right?

    #335843 Reply

    support-michael
    Keymaster

    all: I have isolated 2 problems in this long thread

    PROBLEM-1: Calling preprocessDOM() on existing widgets
    john’s info about event fires in a series: 1, 2, 4, 8… indicates one issue.

    That is preprocessDOM() is being called on existing widgets. This function registers event handlers to widgets. The use-case for this function is to bind event handlers for widgets that are added dynamically via javascript. The function does not unbind previously registered event handlers from any widget. Thus a negative side-effect is that calling the preprocessDOM() across existing widgets performs a redundant event handler binding process.

    I recall having internal discussion about removing existing event handlers before binding handlers and thought it was handled. Seems it is not based on a test I just ran. In the meantime, the recommendation is to avoid calling preprocessDOM(node) if the node contains widgets that have already been preprocessed such as widgets present in the UI on startup.

    PROBLEM-2: javascript alert() is goofing up UI flow in native app (iOS)
    John, running ButtonTest on iOS reveals something quirky with the standard javascript alert() when used in the cordova/phonegap on an iOS device. I confirm the following issue on iphone5/iOS6.1. I have not debugged deep into the framework but the javascript alerts cause the javascript promote to be invoked a 2nd time. I have opened a bug to see if we can determine the root cause of this issue. I do know that using javascript alert in some of the key cordova api wll crash your app (the cordova/phonegap api call this out). It is not in the mobione code but rather in cordova/phonegap runtime, ios uiwebview or other… can’t say anything atm.

    The workaround is to use phoneui.alert() which runs asynchronously in native apps or maybe put your javascript alert in a setTimeout().

    I revised this version of your update() function to use phoneui.alert():

    
    function update()
    {
      var word=prompt('Bitte Update-Passwort angeben:', '');
      if (word!="hallo") {
          phoneui.alert('Passwort nicht korrekt! Vorgang wird abgebrochen!',
                        function(){navigator.notification.vibrate(2000)});
          return;
      }               
      phoneui.alert('done!');
    }
    
    #335850 Reply

    JohnJake2
    Member

    Hi support-wayne.

    Thx for your help. Obviously your work-around solved my probem. Thx again and I would like to hear about the results of your investigation according the discusson of removing all events before connecting them again in the preprocessDOM routine.

    Have a nice weekend.
    JohnJake2

    #336040 Reply

    support-michael
    Keymaster

    Hi John,

    Still researching this topic. I’ll provide more info as soon as I’ve had some time to sync with the dev team for an extended discussion.

    #336878 Reply

    Yann
    Member

    Hello Wayne
    no new about this problem?
    for information, i have this problem only in native app, not in test center.
    Thanks
    Yann

    #336884 Reply

    Unknown Author
    Participant

    I get the two-button-click experience, too – just using nothing more than a Mobione button widget and onclick. I experience it on iOS native iPhone4 and iPhone5. In this app, it happens all the time:

    https://itunes.apple.com/en/app/id528886127?mt=8

Viewing 13 posts - 16 through 28 (of 28 total)
Reply To: onclick function too sensitive

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