Categories > TBS next version >

feature request : use of magnet for different values of the same field

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

feature request : use of magnet for different values of the same field

hi,
the more i use TBS, the more i need this kind of syntax :
<p>Success.[result;magnet=p;case [val]==0]</p>
<p>Error message #1.[result;magnet=p;case [val]==1]</p>
<p>Error message #2.[result;magnet=p;case [val]==2]</p>

when php is :
$fResult = my_function_returning_a_result_code();
$TBS->MergeField('result', $fResult);

that's for my easter wish, and by the way of would you emulate this
without writing a plugin ?
I tried thing like
<p>Success.[result;magnet=p;if [val]==0;then ' ';else '']</p>
<p>Error message #1.[result;magnet=p;if [val]==1;then ' ';else '']</p>

as i understand it, the condition for the second merge
is evaluated for the first merge, so obviously it can't work.

VoilĂ  !
By: Skrol29
Date: 2007-04-11
Time: 00:23

Re: feature request : use of magnet for different values of the same field

Hi,

This is not the first time I hear about such a feature.
Nevertheless, why don't you code the first snippet like this:
<p>Success.[onshow_err;block=p;when [var.result]=0]</p>
<p>Error message #1.[onshow_err;block=p;when [var.result]=1]</p>
<p>Error message #2.[onshow_err;block=p;when [var.result]=2]</p>
By: kapouer
Date: 2007-04-11
Time: 08:05

Re: feature request : use of magnet for different values of the same field

My eyes were blind and now i see !
Thanks.
By: kapouer
Date: 2007-04-11
Time: 08:18

Re: feature request : use of magnet for different values of the same field

By the way, the documentation doesn't (or did i miss it?) say something about
the onshow_xxx syntax
and
[onshow_err;block=p;when [var.result]=1]
could be also
[onshow_err;block=p;when [result]=1]
with a
MergeField('result', $fResult);
By: Skrol29
Date: 2007-04-11
Time: 12:05

Re: feature request : use of magnet for different values of the same field

http://www.tinybutstrong.com/manual.php#html_conditional

The example is only with [onload] but it is is also available with [onshow]