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

Not applicable

Hi,



On client script you can get value of checkboxes as:-



var ch1 = document.getElementById("ni.resolution_time").checked;


var ch2 = document.getElementById("ni.difficulties").checked;


alert(ch1+','+ch2);



Try it, if it works,



Thanks,


Apurva Sharma


anurag92
Kilo Sage

Can you check the ID of the checkbox by doing an inspect element on the checkbox?



find_real_file.png


Inactive_Us1474
Giga Guru

Please check the below thread.


Using onclick with g:ui_checkbox



---------------


Akhil


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