This script allow to disable checbox (rest) when specified ammount (max) is checked. In localhost it works perfect but after uploading it at server it isn't working so fine something it count wrong, sometime it don't undisable. What is wrong here ?
// Repeat Control ID
var repeat = dojo.byId(dojo.byId("#{id:clientID_label}").innerHTML);
// Ammount of checkbox after which rest will be disabled
var iloscOdpowiedzi = dojo.byId("#{id:iloscOdpowiedzi_Label}").innerHTML
var list = repeat.getElementsByTagName('input');
var ilosc = 0;
var wielkoscListy = 0;
for(x in list)
{
wielkoscListy++;
if(list[x].type == "checkbox")
{
if(list[x].checked == true) ilosc++;
}
}
for(x in list)
{
if(list[x].type == "checkbox")
{
if(ilosc>=iloscOdpowiedzi)
{
if(list[x].checked == false)list[x].disabled = true;
}
if(ilosc<iloscOdpowiedzi)
{
list[x].disabled = false;
}
}
}
I discovered that fault of this is server options "No update" but how other way can I pass data I have no idea maybe you can help
This is script onChange in checkbox:
var thisVal = getComponent("checkBox1").getValue();
viewScope.checkBoxVals = viewScope.checkBoxVals || new java.util.HashMap();
if(thisVal.equals("false")){
viewScope.checkBoxVals.remove(index*100+index2);
}
else
{
viewScope.checkBoxVals.put(index*100+index2, thisVal);
}