Store html value in jelly script variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 01:53 AM
On the below script I want to set the number value which is in html text field into the jelly script variable "jvar_number", but the below code didnt work, am i missing something.
Client script:-
addLoadEvent(function() {
var url = top.location.href;
var number = new URLSearchParams(url).get("sysparm_number");
gel('number').value=number;
}
Html:-
<input type="text" id="number"/>
<j:set var="jvar_number" value="${document.getElementById('number').value}"/>
test:-${jvar_number}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 01:58 AM
Hi,
Seems to be you want to get number from URL, so, I think you needn't scripting at client script side;
Just use Jelly script to get URL param (add this block above your logic), example as below:
<j:set var="jvar_number" value="${RP.getParameterValue('sysparm_number')}" />
Hope this help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 02:12 AM
Hi Jack,
Thanks for your response.
Since im using the Ui page on an Iframe , "RP.getParameterValue("sysparm_number") " is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 02:26 AM - edited ‎12-26-2022 02:27 AM
Just wonder if there is any special reason that you want to set back value to jelly object.
As my knowledge, jelly is run at server-phase, then control return to browser client-phase.
I suggest you can try switch your logic to use Jquery client script.
Or can you share your requirement here? ==> then other guys can have overview and see if there is another way to achieve this