facebook

onclick function too sensitive

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

    Yann
    Member

    Hello,
    a question, i’ve a simple button on a remote page calling by ajax whith a function onclick=”myfunction()”
    example

    function myfunction()
    {
    alert('Hello');
    }

    When i click on this button , my function is always called twice and I have two alerts 🙁
    would you have an idea to force the execution once?
    Thanks
    Yann

    #334754 Reply

    support-michael
    Keymaster

    0) what is your test environment that demonstrates this dbl click, e.g., Test Center 2.3.1, iphone/ios6, …?

    1) Can you post a small project that demonstrates this issue?

    #334756 Reply

    Yann
    Member

    Hello Wayne
    i use Test Center 2.3.1, IOS 6 but if i compile my project on IOS i’ve the same problem.
    Sometimes the function is called twice
    i sent you by email an example, so i solved my problem by using

    <input type="button">

    rather

    <button></button>

    Thanks
    Yann

    #334762 Reply

    SonamGyato
    Member

    yeah ran into this problem also.

    my “solution” was …

    save the time when the callback is received.

    if it’s within about 100 ms of the last call – disregard.

    #334781 Reply

    donij
    Member

    Ok……. it’s good someone else have this same experience.

    I raised an issue titled “Duplicate entry for single List.append” in Getting Help – General. After a trace I discovered that the onclick event runs twice and that caused the double entry in the list. I use ver 2.3.1 also. The issue was there right from 2.3. When I hosted the app on a web server I don’t get the multiple click. The problem could be with Test center…… somewhere.

    #334804 Reply

    support-michael
    Keymaster

    @Yann

    I investigate your example and did not observe dbl events, but as you indicated switching your dynamic html to use <button> instead of <input> may be the cure. Why does this occur is not clear yet. Planning to discuss this in more detail with dev team tomorrow.

    #334815 Reply

    Yann
    Member

    Ok Wayne thanks you,
    weird it does not happen every time, I am reassured that I am not alone.
    Yann

    #334823 Reply

    donij
    Member

    Ok… I have changed mine too from <a> tag to <input type=”button”> and I now get a single click. Though what I needed is the <a> tag. Wayne-Octavio pls do the magic……help resolve the double click event for a single button click or <a> tag click. Clicking a list item does the double click too.

    Thanks guys.

    #334844 Reply

    support-michael
    Keymaster

    @donij

    Help me understand the context of your <a> usage. Is the redundant event firing happening in custom html that you have provided? For example @yanni is loading asynchronously loading a fragment of html and weaving it into the dom. His html fragement includes a button. How is your <a> implemented?

    #334847 Reply

    donij
    Member

    Yes wayne….. I build a list dynamically and inside each list item I have the <a> tag in a line like below

    <a href=”#” class=”addtocart”> Add </a>

    I made the replacement as in the colored part

    <input class=”addtocart” type=”button” value=”Add”>

    #334910 Reply

    Hi Yann, donij,

    Dev team is investigating this issue, but we was able to replicate the issue only in Test Center. Could you share if you only got this problem in Test Center? if it happens in any other device could you share details such model and SO?

    #334994 Reply

    donij
    Member

    Not tested in device. Works well when app is hosted on site but multiple clicks when in test center.

    Cheers

    #335010 Reply

    support-michael
    Keymaster

    @donij

    > Works well when app is hosted on site but multiple clicks when in test center.

    That is similar experience to our current testing. That is, problem seem isolated to the Test Center in our testing.

    #335057 Reply

    donij
    Member

    Hi Wayne,

    we are looking forward to the solution. Life has been good with mobione. Can’t wait to see other features like camera support.

    Thanks guys.

    #335596 Reply

    JohnJake2
    Member

    Hi all.
    I am facing the same problem. I use an update button which deletes a table and then rebuild some infomation to store it back in the db.
    Since my update button fires 0 to 5 times (depending on its mood) I sometimes have a mixture of old an new settings, sometimes the table is empty and other times I have my data two or three times.

    This is happening on the device (iPhone 4S). This little app is running as a web app (I did not test it as an iOS App yet).

    The complete thing is similiar to this post: http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=2715&hilit=button+event
    When I let out my

    
    phoneui.preprocessDOM('#m1-Detail'); 

    it works obviously. But letting out this code leads to the problem that my dynamic list that I use does not update the screen anymore. So scrolling down is a problem.

    Are there any news concerning this issue?
    JohnJake2

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

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