- 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 08:41 PM
Hi,
Is the input coming from <g:form> tag?
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 08:45 PM
from this tag - <g:ui_form>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 09:38 PM
Hi,
you cannot access html data within g:evaluate tag
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 09:53 PM
Then can we access client script data within g:evaluate tag?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2020 10:12 PM
Hi,
No
You can pass data from g:evaluate to another g:evaluate
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader