- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 02:41 AM
Hi,
Can anyone tell me the way to pass variables from client script to HTML in UI page ?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 04:04 AM
Hi,
you will have to set the value of some html tag using dom
Something like this
<div class="col-md-5 text-right" style="padding-left:3px">
<g:form_label for="service_select">
${gs.getMessage("How many request you want to clone ")}
</g:form_label>
</div>
<p id="my_id" style="display:none"></p>
<div class="col-md-5 text-left" style="padding-left:3px" >
<select id="times" name="times">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
I am fetching "times " in client script as below:
$j("#times").on("change", function(e) {
var testt = $j("#times").val();
alert(testt);
document.getElementById('my_id').innerHTML = testt;
document.getElementById('my_id').style.display = '';
});
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 02:52 AM
Please explain any script which you have started and where are you stuck
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 03:38 AM
This is the HTML part:
<div class="col-md-5 text-right" style="padding-left:3px">
<g:form_label for="service_select">
${gs.getMessage("How many request you want to clone ")}
</g:form_label>
</div>
<div class="col-md-5 text-left" style="padding-left:3px" >
<select id="times" name="times">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
I am fetching "times " in client script as below:
$j("#times").on("change", function(e) {
var testt = $j("#times").val();
alert(testt);
});
Now I again want this value 'testt' to be used in HTML for further functioning. How can I do so?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 04:04 AM
Hi,
you will have to set the value of some html tag using dom
Something like this
<div class="col-md-5 text-right" style="padding-left:3px">
<g:form_label for="service_select">
${gs.getMessage("How many request you want to clone ")}
</g:form_label>
</div>
<p id="my_id" style="display:none"></p>
<div class="col-md-5 text-left" style="padding-left:3px" >
<select id="times" name="times">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
I am fetching "times " in client script as below:
$j("#times").on("change", function(e) {
var testt = $j("#times").val();
alert(testt);
document.getElementById('my_id').innerHTML = testt;
document.getElementById('my_id').style.display = '';
});
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 07:56 PM
Hi,
Please help me with this
<div class="col-md-5 text-right" style="padding-left:3px">
<g:form_label for="service_select">
${gs.getMessage("How many request you want to clone ")}
</g:form_label>
</div>
<div class="col-md-5 text-left" style="padding-left:3px" >
<select id="times" name="times">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
I am getting input from above code: say the input number is = n;
now I want to run the following HTML code for n times; how can I do that?
<g:evaluate var="jvar_transfer_methods" jelly="true" object="true">
var sysId = RP.getParameterValue('sysparm_sys_id');
var tableName = RP.getParameterValue('sysparm_table_name');
var transferMethods = hr_TransferCase.getTransferMethods(tableName, sysId);
var oneTransferMethod = transferMethods.length == 1;
transferMethods;
</g:evaluate>