Get value of textboxes and other components


#1

Is there a way to get the value of textboxes and toggle buttons in javascript code? I can’t manually set the ID for components to use document.getElementById() method
Thank you in advance!


#2

At the moment, when you drag a component onto the app canvas, it gets an auto-generated ID hash. This hash won’t change unless you delete it, so you can retreive it by inspecting the phone canvas in the editor:

It’s a bit roundabout way now – being able to set the element ID is on the roadmap! Note that the id points to the containing <div> for the component, so the actual component code (as visible in the component code editor) is inside that element.


#3

Also, what you can do is clone the component (by clicking on the clone icon that appears when you hover over it), and add a new property “id”:


#4

Thanks Harri. That was really helpful