Categories > TinyButStrong general >

Is it possible use normal sections and conditional sections at the same time?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Billy
Date: 2007-05-22
Time: 17:54

Is it possible use normal sections and conditional sections at the same time?

As I couldn't get the HTML plugin to select radioboxes when arrays of radioboxes are used, I used conditional blocks to select the radioboxes. The problem is I also wanted to altenate the rows colors, and that's not possible because normal sections aren't recognized when using conditional sections.

For instance, what I wanted to do was this:

     <tr>
      <td><a href="view_invoice.php?invoice=[invoices.invoice]">Invoice #[invoices.invoice;block=tr;when [invoices.status]=1]</a></td>
      <td>[invoices.date_added;frm=YYYY-MM-DD]</td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="1" checked="checked" /></td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="0" /></td>
     </tr>
     <tr>
      <td><a href="view_invoice.php?invoice=[invoices.invoice]">Invoice #[invoices.invoice;block=tr;when [invoices.status]=0]</a></td>
      <td>[invoices.date_added;frm=YYYY-MM-DD]</td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="1" /></td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="0" checked="checked" /></td>
     </tr>
     <tr class="highlight">
      <td><a href="view_invoice.php?invoice=[invoices.invoice]">Invoice #[invoices.invoice;block=tr;when [invoices.status]=1]</a></td>
      <td>[invoices.date_added;frm=YYYY-MM-DD]</td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="1" checked="checked" /></td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="0" /></td>
     </tr>
     <tr class="highlight">
      <td><a href="view_invoice.php?invoice=[invoices.invoice]">Invoice #[invoices.invoice;block=tr;when [invoices.status]=0]</a></td>
      <td>[invoices.date_added;frm=YYYY-MM-DD]</td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="1" /></td>
      <td align="center"><input type="radio" name="invoices[[invoices.user_invoice]]" value="0" checked="checked" /></td>
     </tr>

Do you think this can be corrected on the HTML plugin AND the next TBS version? Or is there any other way to do it?

Thanks.
By: Skrol29
Date: 2007-05-23
Time: 00:54

Re: Is it possible use normal sections and conditional sections at the same time?

Hi Billy,

About the alternated colors of row: alternated sections are available only for normal sections, it doesn't work with conditional sections. I don't think it will be supported in a further version because complex (or unusual) alternating can always be done with other ways: using parameter "onformat" or parameter "ondata".

About the plug-in for radioboxes: it should work even if radioboxes have names for array (with []). But the point is that when the plug-in start to merge radioboxes, real names should be merged, other wise it won't found the names.
Nevertheless, using this plug-in to merge radioboxes (or checkboxes, or listes) which are located inside a block that will be merged can cost a lot of time of processing. It is not optimized.
It is better to managed the checkings with a TBS fields on the "checked" attributes of the <input> tags.
By: Billy
Date: 2007-05-24
Time: 22:31

Re: Is it possible use normal sections and conditional sections at the same time?

About the alternated colors, it's ok. I had looked at the parameter "ondata", just didn't realize how to do it. Though I do now, I used the normal sections with:

   <td align="center"><input type="radio" name="user_invoices[[user_invoices.user_invoice]]" value="1"[user_invoices.paid;if [val]=1;then ' checked="checked"'; else ''] /></td>
   <td align="center"><input type="radio" name="user_invoices[[user_invoices.user_invoice]]" value="0"[user_invoices.paid;if [val]=0;then ' checked="checked"'; else ''] /></td>

I guess that solves the problem with the HTML plugin too. :)

BTW, I didn't understand your explanation about real names on radioboxes merge, but I couldn't get it to work when using checkboxes named like cars[car1], cars[car2], etc.