Jun 13, 2012, 10:16 AM
68 Posts

Strange delay in simple script

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role:
  • Tags:
  • Replies: 1
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);
}
 
 
Jun 14, 2012, 5:14 AM
126 Posts
Re: Strange delay in simple script
"No update" is used when you don't want to refresh the screen, meaning when you want code to figure something out or complete an action but not modify the screen, if your planning to change the checkboxes to a disabled state you will need to either partialy update the section they are in or fully update the screen