I have read the dev docs as much as I can find, and I see we can setValue of any UI element belonging to the bric from anywhere in the js file. But I don’t see how we can getValue???
For clarity, an example of the use case I currently have.
I need to show / Hide a UI element based on the value of another UI element, so I need it’s value for a conditional.
// when one UI elements value changes this function fires.
function SetTheTarget(value,stringValue,attrName)
{
var anotherUIElementVisibility = true
// How to get some other UI element value from this same bric ?????
if (someOtherElementValue == someArbitaryValue) {
var anotherUIElementVisibility = false
}
window.webkit.messageHandlers.setUIHidden.postMessage(
JSON.stringify({
"attr": "ten-ton-data",
"hidden": anotherUIElementVisibility
})
);
}
You need to store this yourself within the Brics HTML and then retrieve it when you need it, using JS, data attributes is a good way around this. Download some of our free Brics to get examples of how we have done this in.
If you place all of this stored data onto a html tag with the class remove-on-export this will be removed when you export to keep the output clean. There are various helper classes which you can read about here.
I’m a big fan of Blocs’ built-in features and rarely need to use any third-party plugins. However, when a developer understands what you’ve just said, it’s incredibly exciting and promising! I’m eagerly looking forward to seeing your ideas come to life!