For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 21 replies, 6 voices, and was last updated 12 years, 4 months ago by
support-octavio.
-
AuthorPosts
-
TorbenKjeldgaardMemberHi everyone
I’m struggling with a small probmem!
This code is placed in my #m1-page-custom.js. under in a function I call when i change Screen. Phone number, email, and url are all correct in the alert box – BUT the alert pops up twice when I click – why is that?
(MobiOne 2.5 – 3)
$(‘#m1-item-txtCall’).html(‘<img src=”images/icon_call.png” width=”50″>’).click(function(){
alert(phone);
});$(‘#m1-item-txtSms’).html(‘<img src=”images/icon_sms.png” width=”50″>’).click(function(){
alert(phone);
});$(‘#m1-item-txtEmail’).html(‘<img src=”images/icon_email.png” width=”50″>’).click(function(){
alert(email);
});$(‘#m1-item-txtUrl’).html(‘<img src=”images/icon_url.png” width=”50″>’).click(function(){
alert(url);
});October 21, 2013 at 3:52 pm #343583
support-michaelKeymaster>the alert pops up twice when I click – why is that?
No idea atm. Can you provide as small example project and we can debug into it. I am assuming there is some interaction between a mobione widget and your html code but the snippet does not give me the full context to say any more.
October 22, 2013 at 9:28 pm #343667
Unknown AuthorParticipantDouble clicks have been a problem with Mobione buttons for a loooong time.
October 23, 2013 at 8:01 am #343689
support-vadimParticipantHi TKT,
Could you please provide minimal sample that reproduces the problem?
I tried to create one ( http://goo.gl/Z8VKsr ) – but I always see only one alert.
If for some reason you can’t provide sample – could you please add alert just before the subscribing to clicks, f.e.alert("Adding click handler"); $('#m1-item-txtCall').html('<img src="images/icon_call.png" width="50">').click(function(){ alert(phone); });to be sure you’re subscribing to click events only once?
And the last thing – if you’re working with M1 push buttons (not custom HTML in CustomHTML control) – you’d better use “OnClick action”->”Run JavaScript” instead of manually subscribing to “click” action in JQuery.
Regards,
Vadim Ridosh
October 23, 2013 at 11:41 am #343710
support-vadimParticipantHi TKT,
We’ve received your files, thanks for providing them.
But the problem you’re reporting is not related to M1. It’s actually the way you’re subscribing to click events. You do this on each page transition event, so when you visit page second time your click handler is called twice, when you visit it third time – three times, etc, etc. You can fix the problem through moving code that subscribed to clicks
$("#m1-item-image_call").click(function(){ var phone = "1111"; alert("Call "+phone); });into phoneui.documentReadyHandler handler, or through applying this trick:
$("#m1-item-image_call").unbind('click.anyid').bind('click.anyid', function(){ var phone = "1111"; alert("Call "+phone); });(I’ve found this trick here: http://stackoverflow.com/questions/8408826/bind-event-only-once/14208653#14208653 )
Regards,
Vadim Ridosh
October 23, 2013 at 11:16 pm #343735
RichardOneMemberHi,
Been having this problem also,
However, it only occurs with the ‘goback’ java code and not with page links?
But here’s what’s strange (at least for me) when I have touched on all the java ‘Back’ buttons a few times the lag in transition disappears and no double click event?
I’m wondering if this is a cache issue?
Go figure…
October 24, 2013 at 12:36 am #343737
support-vadimParticipantHi Richard,
Could you please provide example and steps to reproduce the problem?
Regards,
Vadim Ridosh
October 24, 2013 at 3:19 am #343741
TorbenKjeldgaardMemberHmm – I’ve tried both now – and the problem still occurs. My problem is that i need the phonenumber, email and url are dynamically depending on which item clicked in the list. Is there any way that I can put the phonenumber in to a javascript on the m1?
October 24, 2013 at 8:29 am #343760
RichardOneMemberHi Vadim,
I simply uploaded the app to my phone; scrolled through the content.
Each time I selected a ‘Back’ button using the ‘goback’ jave function, there was/is a distinct ‘double’ firing event and then the page ‘flickers’ momentarily prior to transition to target page.
I have double checked everything; nothing seems obvious in terms of errors.
October 24, 2013 at 8:52 am #343763
support-vadimParticipant@TKT wrote:
Hmm – I’ve tried both now – and the problem still occurs. My problem is that i need the phonenumber, email and url are dynamically depending on which item clicked in the list. Is there any way that I can put the phonenumber in to a javascript on the m1?
Hi TKT,
It seems I caught the scenario you’re talking about.
You can workaround it through using M1 actions instead of jQuery handlers.
I mean, in your viewItem function you should write something like this:$("#m1-item-image_call").data("phone", "1111"); $("#m1-item-image_sms").data("sms", "1111"); $("#m1-item-image_email").data("email", "support@DealsNearbyYou.com"); $("#m1-item-image_url").data("http", "http://DealsNearbyYou.com");Then, in your item.mobi you should assign “Run Javascript” actions to your image buttons and write there something like this
phoneui.alert($(this).data("phone"));This should fix the problem.
Regards,
Vadim Ridosh
October 24, 2013 at 9:28 am #343766
support-vadimParticipantHi Vadim,
I simply uploaded the app to my phone; scrolled through the content.
Each time I selected a ‘Back’ button using the ‘goback’ jave function, there was/is a distinct ‘double’ firing event and then the page ‘flickers’ momentarily prior to transition to target page.
Hi Richard,
I’ve created simple Android app that contains tons of back actions, here is a link to it http://goo.gl/lUcImz
I’ve tested it on several Android devices and all back actions work OK.
Does it work OK on your device?For the case you want to change something to reproduce the problem there are sources of this app: https://drive.google.com/file/d/0B6LZd0Fjqwr2WXBqc012QzlDc2s/edit?usp=sharing
Regards,
Vadim RidoshOctober 24, 2013 at 9:38 am #343768
RichardOneMemberOctavio,
Your test works perfectly?!
So it must be something to do with the button code right?
Are you using the came code?
Thank you for taking the time to compose the test app 🙂
October 25, 2013 at 4:25 am #343811
TorbenKjeldgaardMemberThanks support-vadim,
that did it 🙂
November 3, 2013 at 10:09 am #344030
RichardOneMemberHi Vadim,
It’s not the transitional effects; its the java ‘goback’ function
This is not in your demo
November 4, 2013 at 12:15 pm #344077
support-octavioMemberHi Richard,
We have posted a special Android app that will record all key event and UI state data in order to help us to figure out how to replicate the issue, we will require your assistance with testing the app, find the download link in this thread:
http://www.genuitec.com/support-genuitec/viewtopic.php?p=21758#p21758 -
AuthorPosts
