Categories > TinyButStrong general >

ifempty would cause atttrue to lost effect?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Sheepy
Date: 2014-04-25
Time: 06:51

ifempty would cause atttrue to lost effect?

Hi Skrol29,

Ok, this one should be less clear cut then the others I've reported.

$tbs = new clsTinyButStrong();
$tbs->Source  = '<input/> [onshow; att=input#disabled; atttrue]'; // This field has NO disabled attr.
$tbs->Source .= '<input/> [onshow; att=input#disabled; atttrue; ifempty=[a]]'; // This field HAS disabled attr, disabling it.
$tbs->MergeField( 'a', '' );
$tbs->Show();

The manual says
1. att is processed before ifempty. 
2. att has the effect of moving the field into the attribute.
3. atttrue cause the attribute to be managed as boolean.

What I didn't expect is that ifempty would undo atttrue's "boolean flag", so to speak.

It's ok if I use if instead of ifempty.

Also, in the manual, the link to att in "order of process" (line 2220) is point to script instead of att.
By: Skrol29
Date: 2014-04-26
Time: 01:46

Re: ifempty would cause atttrue to lost effect?

Hi Sheepy,

Thank you very much for reporting those problems.

To reproduce your problem I had to replace <input/> with <input /> otherwise I add a PHP error "Undefined property: clsTbsLocator::$AttName".

I've updated the online manual.
Now it explains that :
  ifempty or atttrue or magnet or attadd, those parameters cannot work together, the first used in this list is applied

But is there a good reason for using "attrue" and "ifempty" together ?
By: Sheepy
Date: 2014-04-27
Time: 23:55

Re: ifempty would cause atttrue to lost effect?

There is always a reason, even if they may not be reasonable. ( https://xkcd.com/1172/ ) ;)

In my case I was trying to set the value to a concat of two or three other merge fields, and if any of them is non-empty then disable the field.

In other words, I was trying to work around the other bug which has been fixed now. :p