jquery .change() not listening to toggle flip-switch state change

6 posts, 0 answers
  1. Alfredo
    Alfredo avatar
    27 posts
    Member since:
    Apr 2012

    Posted 28 Jul 2013 Link to this post

    Hello,

    Ported a jQuery Mobile App from another platform and all of a sudden flip switches aren't being read. No change detected. Already tried with .change(), .bind(), .on() and no luck. Flip switches still work ok in other platform and as a web App but not in Icenium.

    Your help will be appreciated.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 29 Jul 2013 Link to this post

    Hello Alfredo,

    We were able to successfully trigger the switch and it is correctly indicated with the following code:

    <script>
        $('#flip_2').on('change', function() {
            alert($('#flip_2').val());
        });
    </script>

    You can see our observations in the following short video.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Alfredo
    Alfredo avatar
    27 posts
    Member since:
    Apr 2012

    Posted 29 Jul 2013 Link to this post

    Thank you Steve for the reply. This is very strange!. Commented the code on the control.js file, and placed your code in the <head> area and no, no luck. Somehow events are being blocked! This time tried on Mist with same results.

    Let me do a test-on-device and come back to you. Ok?
  4. Alfredo
    Alfredo avatar
    27 posts
    Member since:
    Apr 2012

    Posted 06 Aug 2013 Link to this post

    Steve,

    I'm sorry for insisting on this trivial issue, but something strange is happening here. My javascript  isn't able to modify DOM elements at all. Either with plain-vanilla JavaScript or jQuery no matter what I try just can't, for example, set an input field value or read a flip-switch state change.

    True is in your video thigs are Ok but somehow on my machine and inside Graphite things are different. This is very weird. Can you check on my code as it's now please?

    You may want to check this short video I made: Video

    Thank you!

    P.D. Also tried with checkboxes but nothing seems to work!
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 08 Aug 2013 Link to this post

    Hello Alfredo,

    We do not see how this could be caused by Icenium IDE as what you're doing is a generic javascript intervention. As shown in previous video, the flip-switch operation works on our end with your project. So naturally we have the following questions/suggestions:
    • If the problem was Graphite related, then Mist would work, you already stated that is not the case. If that has changed you can go to %localappdata%\Telerik\BlackDragon\<your_email_here> and delete your project from the folder (that is if you do not have anything to commit to the project). Then Pull from the repository and see if everything is fine.
    • try the same javascript code in a vanilla project - does it work? Consider moving your app files to the new project and identifying the culprit as effect of this. You can also export your project and import it as zip archive (easier, but the problem could still be there and you're not ahead in identifying the issue).
    • isolate the problem in a sample jsbin.com i.e. does this work at all in regular browser.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  6. Alfredo
    Alfredo avatar
    27 posts
    Member since:
    Apr 2012

    Posted 08 Aug 2013 Link to this post

    Steve,

    Thanks for the reply!. As said before this is very strange since even disabling an <input> field wasn't working (with jQuery). The App is coming from another mobile development platform with everything working Ok. However we are a little short in time and found a workaround by replacing the flip-switches with checkboxes.

    We are definitely going to dive in to  this as we would like to use the switch instead in future releases and because we're porting the rest of our Apps to the Icenium platform.

    Thank you!
Back to Top