Categories > TinyButStrong general >

Checkbox selection problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: EmilCf
Date: 2007-10-04
Time: 09:37

Checkbox selection problem

Hi Skrol29, I got a problem about checkbox selection.

Here is my HTML :
<form method="post" action="">
<ul>
    <li><input type="checkbox" name="abc[]" value="a"/>a</li>
    <li><input type="checkbox" name="abc[]" value="b"/>b</li>
    <li><input type="checkbox" name="abc[]" value="c"/>c</li>
    <li><input type="checkbox" name="abc[d]" value="d"/>d</li>
    [abc;ope=html;select='abc[]';]
</ul>
</form>



And my PHP :
$data_ = array('a', 'b', 'd');

$tbs_ = new clsTinyButStrong();
$tbs_->LoadTemplate('abc.html');

$tbs_->MergeField('abc', $data_);
$tbs_->Show();

Item a and b were selected, but not d.

I know TBS cannot locate abc[d], because I set the select='abc[]'.

However, my HTML is dynamic page. I have no idea how many abc[xxx] inputs will be generate with index key. So, in my case, is there any good solution to do such checkbox selection?
By: Skrol29
Date: 2007-10-04
Time: 21:34

Re: Checkbox selection problem

Yes the problem is item abc[d].
The best is simply to not have this name dynamic. Can't you have fixed ?

TBS won't be able to also check items with a key in the name equal to the value. This is very specific.
By: yipikaye
Date: 2007-10-22
Time: 11:46

Re: Checkbox selection problem

Hi EmilCf,

You can use &#91; for [ and &#93; for ] those HTML entities works in tag attributes (e.g. name="abc&#91;d&#93;" )
By: yipikaye
Date: 2007-10-22
Time: 11:52

Re: Checkbox selection problem

Err.. forget what I just said x(