Forum Discussion

SheryBulos's avatar
5 years ago

dynamic change when changing freemarker variable ?

Hello everyone, kindly, how should I change the content of freemarker variable dynamically? when clicking on the button the id of the macro change so the displayed question changes how could I a...
  • AndrewF's avatar
    5 years ago

    FreeMarker is handled on the server side in order to generate the HTML that will be sent to the user. Once the page has been generated, FreeMarker is no longer relevant. So if you want to do scripted interaction like having a clickable button, that would involve JavaScript rather than FreeMarker.

    If you want JS that can switch between visible items, then the data for all the items would need to be sent in the HTML, and you could use CSS to hide the inactive items. Any state about which items are visible would be known in JavaScript and manipulated, e.g., by adding and removing classes.