I’m trying to set up the checkboxes in my form to retain their checked/unchecked status after form was submitted with error, and i’m doing this:
<label><input type="checkbox" name="red" id="red" value="1" [[+fi.red:notempty=`checked="checked"`]] />Red</label>
... but even though the "Red" checkbox gets checked, it doesn’t remain so after submit. Obviously it is still perceived as empty by the filtering engine.
So to debug, i did:
+fi.red is: [[+fi.red]] [[+fi.red:default=`fi.red not set`]]
which promptly outputed "
+fi.red is: 1, fi.red not set" - which are contradictory of course.
Then i narrowed down the issue:
- I tested the :default and :notempty filters with template variables instead of placeholders, in the same form page, they work fine, so the problem is limited to filtering placeholders only.
- I tested the same filters with tv placeholders in getResources, and they work fine, so the issue is unique to FormIt.
Of course, i can always do:
[[!If? &subject=`[[+fi.red]]` &operator=`!=` &operand=`` &then=`checked="checked"`]]
and that works, but that doesn’t change the fact that the :default and :notempty filters don’t work properly for placeholders in FormIt, after submitting the form.
Ok, now for the boring part:
FormIt 1.5.5-pl
MODx Revolution 2.0.8-pl (traditional)
Windows 7 Ultimate x64
XAMPP Apache/2.2.17 (Win32) PHP/5.3.4
mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 (client and server same, afaik)
not using any accellerators,
no errors get generated in the cache log when i run the page in question
Hope this helps. If this is not a bug and i’m just being an idiot (i do that sometimes) please let me know anyway.
Thanks
EDIT: thought that it might be a caching problem, tried with [[!+fi.red:notempty=`checked=checked`]] instead - still no cigar.