- This topic has 13 replies, 6 voices, and was last updated 12 years ago by
support-octavio.
-
AuthorPosts
-
Pablo22MemberThe on Change event on my combo box is firing twice!
jimMemberAre you using SQLITE and with a phoneui.preprocessDOM statement in your custom js?
I ask because I had the same thing happening in one of my apps.
Pablo22MemberSorry to take so long replying!
No, data is provided by a web service as a JSON string.
As a test I added a simple text box onto my screen and added a line in the OnChange event that writes ‘C-Changed’ to this text box. The result was ‘C-Changed C-Changed’ so the event is definitely firing twice.This is driving me nuts!!
nvtsMemberJim,
I am having problems with the preprocessDOM with my sqlite app. What did you do or change for yours.
Thanks
Pablo22MemberFigured it out.
As per the usual intructions I was using phoneui.proprocessDOM(‘#m1-screenname‘) to update the UI following setting the combo box selected item using $(‘select[name=”comboname“] option[value=”value“]’).attr(‘selected’,’selected’).
This updates the entire screen and causes the event to fire twice but if I add the specific combo name onto the end as in phoneui.proprocessDOM(‘#m1-screenname–comboname) then the combo updates correctly and the event only fires once.
jimMemberI’ve researched the heck out of this and it seems to be a common problem. The term I saw online was “bubbling” where events fire more than once in javascript. One thing to do is make sure your javascript is error free.
Everytime I thought I figured it out, something else would bubble. The current app I’m working on heavily uses SQLITE and one thing that seemed to make a tremendous difference was to NOT define the database globally. Do it locally. I was grasping at straws when I figured that out but what tipped me off was looking at other sqlite examples which didn’t define the db globally.
Another thing to consider is the android test center is not completely reliable and will bubble. However when I deploy the app to my android phone, the bubbling stops. Also when I run test center against my app in IOS it doesn’t bubble.
But the number one thing you can do to stop the bubbling is what Pablo discovered. And that’s to not use preprocessDOM against the screen ID. Use preprocessDOM against the specific element (combo box, etc) instead of the screen ID. Because often when I use the screen ID, the bubbles can get crazy and even execute exponentially every time you click. I sometimes had one click firing 50-100 times several clicks in.
I emailed tech support several times about this without a response but I am still curious what they know about bubbling and mobione. Is there possibly a bug within the preprocessDOM code?
support-octavioMemberHi jim, all:
We have isolated one potential cause to redundant calls of the preprocessDOM() function existing nodes. We are providing a revised implementation of this phoneui.js api in the next update. We plan to make it available by the end of this week.
jimMember@support-octavio wrote:
Hi jim, all:
We have isolated one potential cause to redundant calls of the preprocessDOM() function existing nodes. We are providing a revised implementation of this phoneui.js api in the next update. We plan to make it available by the end of this week.
That’s great news Octavio, Thanks for the update.
support-octavioMemberWe have released Mobione 2.3.2 and would like you to give a try your app with issue using the preprocessDOM function. You can download it here: http://www.genuitec.com/mobile/download.html
Your feedback is really appreciated.
jimMemberKudos to your developer team Octavio!
I am sort of a packrat of code and dug out an old example that I tested again tonight before installing your recent update. It was one of my exponential click bugs where you click add 2 records and 4 would be added then 8 then 16 …. would be added with each click. After verifying the code was broken in the old release I then installed the mobione update tonight and sure enough you guys fixed it.
So I’m guessing that we can go back to using preprocessDOM against the screen ID instead of using the elements. Pizza for everyone !
Thanks,
support-octavioMemberHi jim,
Thanks for sharing your success. We are glad to know that your problem is solved.
BrandonMemberThis is good to hear, I have a quiz that was doing the same thing, it would try to answer the next question as well with the same selection, I will check it tonight to see if its working !
dabbeljuMemberHi all,
sorry if I hijack this topic, but I guess my problem goes into the same direction.
I have the problem, that the click Event is fired twice (at least). I have bee searching the web and tried different suggested solutions. The only one which worked for me is, if I do what I want to do in the documentReadyHandler section.
But this is not suitable for what I want to achiev. Background for what I am doing is, that I load html into a div. No magic so far. But the html may have forms and links in it. If they are clicke, the whole page will navigate to the destination. I have opened for this another thread and got good ideas and most likely a way to get around it without using an iFrame.
If you start the attached project, it will load the desired html page and displays it. Afterwards it is adding the .click handlers to each <a> in the document to get control over it. In the project I take no action currently, because this is not important for the problem. If you klick on a link it will simply say in the debug window of MobiOne TestCenter “Clicked” and this is as it should be.
Again, unfortunately I can not do it this way, cause I do not know about the html at this point.
If you click on the button “load again” it will call a function which I am using to load the html and will again add afterwards the .click handlers. If you click a link now you will see in the debug window, that the event is fired twice.
Any idea, what the problem could be?
Thanks in advance and best regards
DabbeljuAttachments:
You must be logged in to view attached files.
support-octavioMemberHi dabbelju,
Take a look at modifications to next file that Vadim(lead team) have provided. Note that Test Center is still firing two times the action; in our tests in chrome and devices this doesn’t happen, we’ve already opened a bug for this. Let us know how it goes for you.
Attachments:
You must be logged in to view attached files. -
AuthorPosts