Categories > TinyButStrong general >

Show/Hide checkboxes (dinamic)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Quati
Date: 2006-05-29
Time: 21:46

Show/Hide checkboxes (dinamic)

Hi, im having a problem.

I have an array that is used to construct checkboxes with this following format:

[0]
  ['desc'] => "Guard: John Mister"
  ['chk'] => "0"
  ['hide'] => "0"
[1]
  ['desc]' => "Checkpoint: Administration"
  ['chk'] => "1"
  ['hide'] => "1"
[...]

The meaning of this is: 'desc' is the description of the checkbox. 'chk' is to inform
if the checkbox is checked or not. 'hide' is to inform if the checkbox is show or not in the form.

The HTML side is this:

<input type="checkbox" value="[blkChkSpecificRegister.desc;block=input;when [blkChkSpecificRegister.hide]=0]" name="SpecificRegister[]" [blkChkSpecificRegister.chk; if [val]=1; then 'checked="checked"'; else '']>[blkChkSpecificRegister.desc;if [blkChkSpecificRegister.desc]!=''; then '[blkChkSpecificRegister.desc]<br>';]</input>

The PHP side is this:

$TBS->MergeBlock('blkChkSpecificRegister',$this->sessionArray);


The desc and chk option works fine. But Im having problem with the 'hide'... I tested a lot but
dont get any solution. I believe that the problem is in the HTML side, specially in the hide sentence.

Please, can anyone help me?

Thanks
Flavio
By: Skrol29
Date: 2006-05-30
Time: 00:53

Re: Show/Hide checkboxes (dinamic)

Hi,

I've tested your snippet and hiding si working ok for me.

Just a comment: you could replace
[blkChkSpecificRegister.desc;if [blkChkSpecificRegister.desc]!=''; then '[blkChkSpecificRegister.desc]<br>';]
with:
[blkChkSpecificRegister.desc;if [val]!=''; then '[val]<br>']
By: Quati
Date: 2006-05-30
Time: 01:45

Re: Show/Hide checkboxes (dinamic)

Hi Skrol!

I dont know what happened. Now its working ok here, too.

Maybe it was the browser that is a little nuts! :)

Thanks for the attention and the tip!
By: Sheepy
Date: 2006-06-01
Time: 08:14

Re: Show/Hide checkboxes (dinamic)

I've never tried this, but my guess is it is related with order of merging.  Since the containing blkChkSpecificRegister block comes first, it is resolved first, and so the condition values are not yet merged and hence fails.