jeudi 2 avril 2015

disable checkbox which is not selected

I have a checkbox in my form with some of them are checked. when i select view option from view/edit it only displays the checkbox which is already selected as checked and all others as disabled.. my code is below


Applied To



<div class="span12 checkbox-grid" name="class[]" >
<?php if ($view=="View") {?>
<?php foreach ($class as $class) : ?>
<li>
<input type="checkbox" name="class[]" value="<?php echo $class->class_id; ?>"<?php foreach ($class1 as $row1){ echo $class->class_id == $row1->class_id ? 'checked="checked" ' :'disabled';} ?> >
<label style="display:inline"><?php cho $class->class; ?></label>
</li>

<?php endforeach;}} else{ ?>

<?php foreach ($class as $class) : ?>
<li>
<input type="checkbox" name="class[]" value="<?php echo $class->class_id; ?>"<?php foreach ($class1 as $row1){ echo $class->class_id == $row1->class_id ? 'checked="checked" ' :'';} ?> >
<label style="display:inline"><?php echo $class->class; ?></label>
</li>

<?php endforeach; ?>

</div>
<div class="span10 checkbox-grid">
<input type='checkbox' name='checkall' onclick='checkedAll(form);'>
<label style="display:inline">All</label>
</div>
</div>


in controller


$data['class'] = $this->model['registration']->class_list(); $data['class1'] = $this->model['registration']->class_list1($this->url_slice(3, 0));





Aucun commentaire:

Enregistrer un commentaire