We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Check box value from UI page

madanm7786
Mega Guru

Hi All,

I have configured a ui page with 2 check box. Below is the code.

<g:ui_checkbox name="resolution time" id="check1" onclick="addvalue();"/>Check1

<g:ui_checkbox name="difficulties" id="check2" onclick="addvalue2();"/>Check2

Now i need to have these checkbox values in client script. Below is the code.

function addvalue()

{

  var ch1 = document.getElementById("check1").checked;

  alert("Check1 is: "+ch1);

}

In the alert i am getting "UNDEFINED".

How to get the value. Please help me on this.

Thanks,

Maddy

1 ACCEPTED SOLUTION

madanm7786
Mega Guru

Hi All,



Below peice of code worked for me.



<g:ui_checkbox name="resolution time"/>Check1


<g:ui_checkbox name="difficulties"/>Check2



Now i need to have these checkbox values in client script. Below is the code.


function addvalue()


{


  var ch1 = document.getElementById("resolution_time").value;


  alert("Check1 is: "+ch1);


}



Thanks for all your support.



Thanks,


Maddy


View solution in original post

5 REPLIES 5

HD3
Tera Contributor

If you use a regular input checkbox:

<input type="checkbox" id="resolution_time" name="resolution_time" value="${sysparm_resolution_time}"/>

where the default value is set in sysparm_resolution_time, then you can get the value like this in the client script:

gel('resolution_time').checked;