Solved! Go to Solution.
Hi,
You cannot use client side javascript variables value for server side execution.
You can always execute the code and based on javascript condition show/hide or do business logic on client side.
Please find similar query posted @ https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/pass-value-from-js-to-sly-...
Please see if this helps.
Thanks
Anika
Hi,
You cannot use client side javascript variables value for server side execution.
You can always execute the code and based on javascript condition show/hide or do business logic on client side.
As mentioned by Arun, you can not use clientSide variables to render server side scripts.
In this case, you render your HTML and use javascript to show/hide block based on js Variable value.
<div class="showInput"> <input type="radio" id="north-america" name="regions" value="north-america" class="destaco-input-radio"> <label for="north-america">${"America" @ i18n, context='html'}</label> </div> # Hide showInput div block on page load <style type="text/css"> .showInput { display: none; } </style> <script> if(isTrue) { // Display showInput div block if JS object is true } </script>
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies