Running into the same problem in 2.0.7... while the workaround is a possibility, I’m also wondering why this wont work on placeholders...
A similar (but slightly cleaner imo) workaround could be
[[!+fi.error.email:isnot=``:then=`<br />[[!+fi.error.email]]`]]
-
- 4,149 Posts
You should make those placeholders uncached.
shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect |
github |
splittingred.com
I can’t talk for James, but it aint working for me uncached either...
-
- 2 Posts
I was struggling to get this working. Seems to be important to put the snippet call that sets the placeholder in the code before :notempty.
-
- 483 Posts
I have found that the following works reliably after researching caching with my own issues.
[[!+placeholder:notempty=`[[+placeholder]]`]]
I am sure that the answer lies somewhere in the cached versus uncached dilemna regarding Snippets. Since I didn't see a clear answer on this, I must assume that others are still having problems with this. This also seems to keep with consistent for Properties and Chunks as well. The following all work reliably:
[[!snippet:notempty=`[[snippet]]`]]
[[!$chunk:notempty=`[[$chunk]]`]]
[[!*field:notempty=`[[*field]]`]]
[[!++setting:notempty=`[[*++setting]]`]]
While it is not necessary for all of the above, it does help provide a "standard of practice" that is simple to remember.
Note: After finding this, I also checked it with other modifiers that "weren't working". This seemed to provide more reliable results with those, as well.
[ed. note: fuzzicallogic last edited this post 11 years, 1 month ago.]
-
- 26 Posts
Hi Gang,
Likewise I have had intermittent problems with Output modifiers and ":notempty" :default etc, no resolution.
(a) the parser does not always correctly determine what "empty" means. It treats the number zero as empty for example.
(b) Tvs and placeholders fail intermittently on the empty tests.
It's a big minus to have to constantly think about this--PHP coding is not supposed to be easier. My workaround today was to make my values required. (allow blank = No)
FYI.