Categories > TinyButStrong general >

Retaining checked boxes

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Dynamic
Date: 2007-11-26
Time: 09:46

Retaining checked boxes

Hello,
After a form is filled, I am unable to retain the selected list. Could anyone please fix the error?

--- code
HTML template:
   <tr align="left" valign="middle">
      <td>
          <input name="part_ch[]" type="checkbox" value=[prtpc.val]>
      </td>
      <td>
          [prtpc.key;block=tr]
      </td>
   </tr>


PHP code:
$partcp = array('author'=>'PA',
                'Paper '=>'PC',
                'Student'=>'SPC',
                'Attend'=>'AC',
                'Workshop'=>'WC',
                'Industrial'=>'IE');

$TBS->MergeBlock('prtpc',$partcp) ;

.
.
(during reload part)
$part_ch = $_POST['part_ch'];

$TBS->Show() ;

---
This does not select the already checked boxes
By: Skrol29
Date: 2007-11-26
Time: 11:04

Re: Retaining checked boxes

There is nothing in your snippet to select checkboxes.

You can use the HTML plug-in to do this.
By: skey
Date: 2007-11-27
Time: 16:28

Re: Retaining checked boxes

part_ch[]  ==>  [] 

i think the error is on keyword "[]"


------------------------------------------------------------------------
$partcpname="pactch[]"
-------------------------------------------------------------------------
<input name="[partcpname;protect=no]"  >
By: Dynamic
Date: 2007-12-01
Time: 14:54

Re: Retaining checked boxes

Thanks Skrol29 and skey. Sorry for the delayed response, but I was held up with other things. I tried with check boxes, but unable to make it work, though it was easy to do the same with the pull-down menus (thanks to the examples). I tried a few variants, but I couldn't get it work. Could anyone suggest how to modify the following pulldown to checkboxes please?

---<snippet>---

<td><select name="prtpc_type" class="normal" id="select2">
<option value="[prtpc_blk.val]">
   [prtpc_blk.key;block=option]
</option>

<option>
   [var.prtpc_type;ope=html;select]
</option>
</select>


---<end snippet>---