And we know we can use a condition on a dmx-on:click
For example: dmx-on:click="browser1.viewport.width > 576 ? (selected_index.setValue(ID) + data_detail1.select(ID)) : (selected_index.setValue(ID) + data_detail1.select(ID) + offcanvas1.show())"
(this works fine, btw)
So I need to modify my button (or any other clickable item, doesn’t have to be this button) to check a variable and either:
javascript:history.back() -OR- goto a specific page/URL
Spent 30 minutes and can’t figure it out. I was trying to do a condition in the bind:href statement, but the condition kept getting a syntax error at the “:” . I just think a condition doesn’t work on dmx-bind:href
Any ideas?
What you can’t do is call JS functions in dmx. Anywhere.
So you need to create a function separately>
function goBack(){ javascript:history.back() }
And then NOT use href, and instead use dmx-on:click.
Here, use a flow to set the same condition and use RUN step for regular url browser.goto and RUN JS step to call goBack JS function.