way to pass variables from client script to HTML in UI page ? Thanks in advance!

Sunidhi Srivast
Kilo Contributor

Hi,

Can anyone tell me the way to pass variables from client script to HTML in UI page ? 

Thanks in advance!

1 ACCEPTED SOLUTION

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

19 REPLIES 19

Hi,

Is the input coming from <g:form> tag?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

from this tag -  <g:ui_form>

Hi,

you cannot access html data within g:evaluate tag

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Then can we access client script data within g:evaluate tag?

 

Hi,

No

You can pass data from g:evaluate to another g:evaluate

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader