- 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
04-29-2021 12:10 AM
We can do that as well. The only thing that needs to be kept in mind is coloring only those cells which are in start and end date.
We are unable to find a way to color it at that point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2021 12:37 AM
that you can handle by comparing the start date in <j2:if> tag
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2021 12:54 AM
With the below loop we are populating the value in the tabular form coming from the custom table. How we can compare within this loop and color the cells. Please help. I am unable to do so.
<j2:while test="$[gr.next()]">
<tr >
<td> $[gr.getDisplayValue('u_business_application') ]</td>
<td> $[gr.getDisplayValue('u_owner') ]</td>
<td id="demo1"> $[gr.getDisplayValue('u_start_date')]</td>
<td id="demo2"> $[gr.getDisplayValue('u_end_date')]</td>
<td> $[gr.getDisplayValue('u_refernce_id')]</td>
<td>$[gr.getDisplayValue('u_description')]</td>
<td id="xyz"></td>
<td id="abc"></td>
<td id="pqr"></td>
<td id="def"></td>
<td id="ghi"></td>
<td id="yes"></td>
<td id="app"></td>
<td id="page" ></td>
<td id="text1"></td>
<td id="text2"></td>
<td id="text3"></td>
<td id="text4"></td>
</j2:while>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2021 02:11 AM
Something like this
<j2:while test="$[gr.next()]">
<tr >
<td> $[gr.getDisplayValue('u_business_application') ]</td>
<td> $[gr.getDisplayValue('u_owner') ]</td>
<j2:if test="Compare here the value">
<td id="demo1" style="color:blue"> $[gr.getDisplayValue('u_start_date')]</td>
</j2:if>
<td id="demo2"> $[gr.getDisplayValue('u_end_date')]</td>
<td> $[gr.getDisplayValue('u_refernce_id')]</td>
<td>$[gr.getDisplayValue('u_description')]</td>
<td id="xyz"></td>
<td id="abc"></td>
<td id="pqr"></td>
<td id="def"></td>
<td id="ghi"></td>
<td id="yes"></td>
<td id="app"></td>
<td id="page" ></td>
<td id="text1"></td>
<td id="text2"></td>
<td id="text3"></td>
<td id="text4"></td>
</j2:while>
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2021 07:05 AM
Thank you Ankur for the script but our requirement is to color the below cells (J,F,M,A,M,J,J,A,S,O,N,D) which are in blue but we can't use "<", ">" these symbols in <j2: if> tag.
Now for the second record, we have Start Date - 2021-04-23 and End Date - 2021-07-20. So we want A,M,J,J (April, May, June,July as in the start and end date) column in Blue for the second record (Second Row- HR-HR-General) rest should be in white
