“Toggle list item” toggling when label tapped?

Hi there,

I’m new to AppGyver but has been building in it now for a little while and I’m stuck on a UX enhancement I’m trying to make where I’d like to have it so that when a user presses the label of the “Toggle list item” component, that it toggles the toggle - right now you’ve got to click precisely in the toggle button itself which isn’t very friendly

Any ideas how to achieve that? I’ve tried putting trigger events onto the toggle list item component itself (the “toggle tap” or “title tap”events) and the component label inside the toggle list item (“component tap” event) but in either case it doesn’t work. If I trigger an alert I can see that it at least registers the “component tap” event on the label but my triggering of the “toggle tap” event does nothing.

Am I going about it all wrong? If so how do I make a click on the toggle list item label actually switch the toggle? If I could run a formula it would probably be easier, and I understand I can run custom JS but haven’t the faintest clue on how I’d actually code that up in my situation.

Thanks a lot in advance for any pointers!

Hi,

Hmm this is actually surprisingly difficult! Thanks for bringing it up, I’ll make a note to fix this. I did succeed in one way, maybe this can help you too. I’m guessing you have the toggle value bound to something? For testing I created a true/false page variable and bound it to the value of the toggle. Then, I added a Set page variable node after the Title tap event, and change the variable node to !pageVars.toggle_value with a formula. This seemed to have the desired effect, could it be applicable to your use case?

Hi,
I did this using the primitive Toggle.
I have a toggle button and text field on the same row.
First of all I created a boolean page variable to store the value.

Important: i had to attach a “set page variable” function to the page mounted event, to set the AutEsterno to false and avoid problems… I think it was needed to initialise the variable.

Then I created the row and on the left cell the toggle button: its default value is the value taken from the variable:

When the user taps the toggle, the value of the variable is updated:

On the right cell of the row I inserted a text field, for which I activated a tap event, that is basically a simple IF condition: if the value of the variable is true, set it to False; if not, set it to True

When the user tap the text the value of the variable is changed, and the toggle will switch as well.

I hope it could help you or someone else. If you have found better solution, please let me know.
Happy Appgyver!
Alessandro