Categories > TinyButStrong general >

Bug? att=+tag would exclude next <tag> from current merging.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Sheepy
Date: 2014-03-11
Time: 12:17

Bug? att=+tag would exclude next <tag> from current merging.

Bug? att=+tag would exclude next <tag> from current merging.

If I use att=+tag to forward set a boolean attribute, that tag would have the attribute set (or unset) but other tbs tag in it would not be merged.

It merges ok if I use backward search instead.

$tbs = new clsTinyButStrong();
$tbs->Source  = '[data.a; att=+input#disabled; atttrue] <input value="[data.a]" />';
$tbs->Source .= '<input value="[data.b]" /> [data.b; att=input#disabled; atttrue]';
$tbs->MergeField( 'data', [ 'a' => 1, 'b' => 1 ] );
$tbs->Show();

Result: both input are disabled, but first input has a value of [data.a] instead of 1, while second input shows 1 correctly.
By: Skrol29
Date: 2014-03-11
Time: 23:35

Re: Bug? att=+tag would exclude next <tag> from current merging.

Hi Sheepy,

Thank for this problem too. It seem you are driving parameter "att" on interesting limits.

There is warning in the documentation:
- Method MergeBlock() cannot move a TBS field over another TBS field placed after it. This makes a TBS error to occur.

It seems that you are not closed from this case.
I will have a deeper check to understand what is happening for TBS.
Let me few days for reporting the result.
By: Sheepy
Date: 2014-03-12
Time: 06:51

Re: Bug? att=+tag would exclude next <tag> from current merging.

Yeah. I was working on a part that is perhaps better served by PHP and javascript.

It looks like this:

                  <label> <input type='radio' name='status' value="C" /> Contract Signed
                     [data.contract_signed_on; if [val]=''; then 'Change project status?'; else ''; noerr; att=input#data-confirm; magnet=#]
                     [data.project_started_on; noerr; att=input#disabled; atttrue] [data.status; att=input#checked; atttrue=C] </label>
                     <input value="[data.contract_signed_on; noerr; ifempty=(Pending); frm=yyyy-mm-dd] [data.contract_signed_by_name; noerr]" disabled />
                     <input class="input" name="contract_signed_notice" id="contract_signed_notice" value="[data.contract_signed_notice; noerr; frm=[onload._SESSION.company.userid]]" placeholder="(Notice)">
                     [data.contract_signed_on; noerr; att=input#disabled; atttrue]
                     <input id="contract_signed_notice_name" value="[data.contract_signed_notice_name; noerr] [data.contract_signed_notice_department_title; noerr]" disabled />

This is one block.  There are six pages, each with three to five blocks.  We already have the status list defined in PHP.

Next refactoring, perhaps. :p