How to get "Value" of One Way Toggle Checkbox.

Hi gays:

I need make one proyect of portlet, and I need obtein the value of “One Way Toggle Checkbox”, I read in the documentation at the method .getValue() request “true” or “”. But I not obtein the value.

This is my code, that I have in one Script Block:

Event.observe($(’#{activePageBean.clientIds[‘togglefour’]}’), “click”, function() {

alert(“0”);

var seleccion = CAF.model(’#{activePageBean.clientIds[‘togglefour’]}’).getValue();

alert(CAF.model(’#{activePageBean.clientIds[‘togglefour’]}’).getValue());

	if(seleccion = 'true')
	{
		alert("Yes inside");
	}
	
            else if(seleccion != "true")
	{
                    alert("Not inside");
            }

alert(“1”);
});

One suggestions that how obtein the value???

Please try this:


var toggle4 = CAF.model('#{activePageBean.clientIds['togglefour']}');
var value = toggle4.element.getValue();

If the item is checked, the value will be “on”. If it isn’t checked, the value will be “null”. (At least on Firefox)

Regards,
–mark

Thanks for your support, I applied your code and worked :).

Thanks.