SD-29 fix js

This commit is contained in:
Claire DELBOS 2017-03-31 14:21:35 +02:00
parent 550c409a4b
commit e8fb280981

View File

@ -12,26 +12,35 @@
<?php endif;?>
<?php else:?>
<?php if ( $this->columns!==false && count($this->columns)>0 ):?>
<?php foreach ( $this->columns as $code => $lib ) {?>
<input type="checkbox" id="help<?=$code?>" onClick=setHelpVal(this)>
<?php foreach ( $this->columns as $code => $lib ):?>
<input type="checkbox" id="help<?=$code?>" onClick=setHelpVal(this) >
<span style="font-size:9px;"><?=$code?> : <?=$lib?></span><br>
<?php }?>
<?php endif;?>
<?php endif;?>
</ul>
<?php endforeach;?>
<script>
setListChecked();
function setHelpVal(obj){
var iref = $('input[name=contentieuxliste]').val();
var iref = $('input[name=<?=$this->key?>]').val();
var chp = obj.id.substr(4);
if(obj.checked){
if(iref.length>0){
chp=','+chp;
}
$('input[name=contentieuxliste]').val(iref+chp);
$('input[name=<?=$this->key?>]').val(iref+chp);
}else{
iref=iref.replace(chp,"");
iref=iref.replace(",,",",");
$('input[name=contentieuxliste]').val(iref);
$('input[name=<?=$this->key?>]').val(iref);
}
}
function setListChecked(){
var iref = $('input[name=<?=$this->key?>]').val();
var tab=iref.split(",");
for(var i = 0, l = tab.length; i < l; i++){
var chp=tab[i];
document.getElementById('help'+chp).checked=true;
}
}
</script>
<?php endif;?>
<?php endif;?>
</ul>