| By: TomH Date: 2009-03-11 Time: 22:44 | ondata func inside a serial block?Hello 
I am attempting to display checkboxes using a serial display -- and I need to set some of them them as "checked" depending on the result of a db query 
my template | <table class="sustain_crit" border=0 cellspacing=0 cellpadding=0 > <tr bgcolor="">
 <plug>
 <td width="3%" nowrap=nowrap class="td-crit">
 <!-- [by.val;ondata=checkme;]  -->
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_1.val; noerr]"
 [by.ischecked;noerr] />
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_1.val; block=td;]</span>
 </td>
 </plug>
 
 <plug>
 <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_2.val;noerr]" [chk.ischecked;noerr] >
 </td>
 <td width="31%" nowrap=nowrap>
 <span class="text-mini">[by_2.val;block=td]</span></div>
 </td>
 </plug>
 
 <plug>
 <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_3.val;noerr]" [chk.ischecked;noerr] >
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_3.val;block=td]</span>[by;block=tr;serial]</div>
 </td>
 </plug>
 
 </tr>
 
 <tr bgcolor="">
 <td valign="middle"> </td>
 <td colspan="2" valign="middle" class="text-mini"><font color="#666666">This line is optional</font><font color="#666666">, it enables you to<br>define the empty cell.</font></td>
 <td valign="middle" bgcolor="#E4F1E4"><div align="center">   <span class="text-mini">[by_0;block=td]</span> [by;block=tr;serial]
 </div>
 </td>
 </tr>
 </table>
 | 
For simplicity my php function is just trying to check all boxes to get this working | $setarray = array('Recycled Content','Recylable','Rapidly Renewable','GreenGuard Certified','Cradle to Cradle','FSC Certified','SCS Certified','Low Maintenance','Exceptional Durability'); 
 $TBS->MergeBlock('by',$setarray);
 $TBS->Show();
 
 function checkme($BlockName,&$CurrRec,$RecNum){
 $CurrRec['ischecked'] = " checked ";
 }
 | 
Can anyone see what I'm doing wrong???
 
Thanks a lot
  | 
	
      | By: Skrol29 Date: 2009-03-12 Time: 10:49 | Re: ondata func inside a serial block?Hi TomH,
 Parameter "ondata=checkme" should be placed on the same TBS fields as "block=...", otherwise it is ignored. All block parameter should be placed on the same tag that defines the block.
 | 
	
      | By: TomH Date: 2009-03-12 Time: 12:35 | Re: ondata func inside a serial block?Hi Skrol, 
this is what worked | <plug> <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_1.val; noerr]" checked="[by_1.ischecked;noerr]" />
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_1.val; block=plug;ondata=checkme;]</span>
 </td>
 </plug>
 | 
Normally (my experience) the ondata call needs to be placed before the 'calculated' field in order for it to work. But in this case I had to move it to the last field in the block.  
Is that unique to the serial block -or- am I missing something different at work here? 
Thanks a lot for your kind help as usual, 
TomH
 | 
	
      | By: TomH Date: 2009-03-12 Time: 13:14 | Re: ondata func inside a serial block?My error, is not working. 
My html syntax was incorrect, by improperly using the checked="[by_1]" the checkbox is checked for any value of by_1 (even null).
 | <plug>-- this code -- <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_1.val; noerr]" checked="[by_1.ischecked;noerr]" />
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_1.val; block=plug;ondata=checkme;]</span>
 </td>
 </plug>
 | 
-- should have been --
 | <plug> <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_1.val; noerr]" [by_1.ischecked;noerr] />
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_1.val; block=plug; noerr]</span>
 </td>
 </plug>
 
 <plug>
 <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_2.val;noerr]" [by_2.ischecked;noerr]>
 </td>
 <td width="31%" nowrap=nowrap>
 <span class="text-mini">[by_2.val; block=plug;  noerr]</span></div>
 </td>
 </plug>
 
 <plug>
 <td width="3%" nowrap=nowrap class="td-crit">
 <input class="check-box" type="checkbox" name="sustainable[]" value="[by_3.val;noerr]" [by_3.ischecked;noerr]>
 </td>
 <td width="30%" nowrap=nowrap class="td-crit">
 <span class="text-mini">[by_3.val; block=plug; noerr]</span>[by; block=tr; ondata=checkme; serial]</div>
 </td>
 </plug>
 
 </tr>
 | 
Notice that the solution for me was that I wasn't placing the ondata param in just the block definition that contained the 'serial' parameter (I was placing the ondata parameter in the by_1, by_2, and by_3 blocks). 
It actually makes sense, duh!.
 
Thanks, 
TomH | 
	
    
	
    
      |  | 
		  Posting in progress.Please wait...
 |