Element Javascript "on click" event doesn't work on tablets

Ivan4o0o

Member
Hi there,
So I have a dropdown element and javascript on it which shows or hides another element when a user clicks on it . It works fine, but not on tablets and smartphones. I know that there are some differences in the events on desktops and on laptops, but I don't know how to add event listener and which event to watch for. I tried this code on a "on load" event of a element javascript, but it does not work.

PHP:
var field = Fabrik.getBlock('form_2').formElements.get('queries___labor_subservice');

field.addEvent('touchstart', function () {
    alert('you touched this element');
});

The click event only works when the user taps on the dropdown field, but if the user taps on an option (selecting it) the on click event is not fired.

Does anybody gaot an idea of sorting this out.
 
Last edited:
It will be perfect if could, but somehow it does not work because another cascading dropdown is watching it. and if I add javascript on onchange event the cascading dropdown does not load its values.
My problem is the same as in this tread. And rob said that it is some problem with the cloning the on change event.
I'm stumped on this one - other events are correctly cloned for other fields, just not the onchange for the select list. I think it might be a mootools bug.

I suggest you replace 'onchange' with 'onlbur' that seems to work

So this is why I can't use "on change". And this if I can say "bug" is making me look for a workaround solution ... :(
The problem in this case is when a user with a desktop click on a dropdown value selecting it, the onclick event is fired and everything is working fine, but on android when a user taps on a dropdown a box with the options is shown and when the user taps on an option selecting it the onclick is not fired. If the user taps again on the (already) selected dropdown the onclick is fired and the JS script then works fine, but the user have to click again and this is not a solution because he wont know to do that.
 
I just tried on my HTC 10, running Android 6.0.1 and the latest Chrome. It seems to work fine. I can hang a 'change' event on a join element, with a CDD that watches it, and my change code runs, and the CDD reloads. It also seems to work fine in a repeat group, where the join/CDD are being cloned.

One thing to try, I'm using the "Enhanced" (or Advanced, or whatever we call it) dropdown feature, so it uses the 'chosen' jQuery widget for dropdowns.

-- hugh
 
Ok thanks. I'll try it with the enhanced feature.
Just to be clear -how you hang a change event? As a standart js with the Event field set to onChange and let say to hide another element and you have a CDD wathing it and it refreshes well when when the field with the JS changes? Is that right?
 
Yes.

And I'm using Chrome's remote debugging, with my phone connected via USB and remote debugging enabled, with breakpoints set in both the CDD and element event handling methods, to confirm that events are running.

-- hugh
 
I have an issue with fabrik sorting. The issue is that once a table is sorted, I can't edit the records. When I click the edit button after the list has been sorted, it does not open the record in a new pop-up window. Instead it opens the record in a new page and the information is not saved. This has to work.
 
Sounds like this has nothing to do with mobile browsers and the 'onclick' event, so you should start another thread.

Sent from my HTC6545LVW using Tapatalk
 
We don't do support by PM. As I said in my last response, and as Bea said in response to your PM, please start another thread in the forum.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top