We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22377 ☆ A M B ☆
    • 33 Posts
    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.
      • 13460
      • 47 Posts
      I think I’ve got similar problems.

      Trying to throw an error in input field name=contact_subject by a conditional statement but doesn’t work;
      placeholder="[[!+fi.error.contact_subject:equalto=``:then=`your subject here`]]" tabindex="3" value="[[!+fi.error.contact_subject:equalto=``:then=`[[!+fi.contact_subject]]`:else=`[[!+fi.error.contact_subject:notags]]`]]"
      

      Above code will output ’your subject here’ in placeholder when loading page
      when input has less then 4 characters it should trigger an error but doesn’t; placeholder is empty BUT value property is also empty!

      Tested: [[!+fi.error.contact_subject:notags]] and it works fine. No <span class="error"> wrapped around error.
      empty or !empty outputfilters also not having the expected result.


      EDIT:
      also found out that :notags output-filter doesn’t work in nested placeholder --> else=`[[!+fi.error.contact_subject:notags]]`]]" is empty, without :notags it will show value of the placeholder
      Test it yourself http://www.myradon.net/, form at bottom of page (dev-server so could go offline)

      So it looks like we’re having the same problem
        UI /UX designer + bit of Front-End Developer. Getting around with MODx Revolution
        • 37242 ☆ A M B ☆
        • 339 Posts
        I have the same Problem here sad

        2.1.3-pl, concerns my gallery.
          • 44064
          • 185 Posts
          Hi,

          It is very interesting did you manage with this issue? It seems I have the same situation with radio's buttons.
            Anton Tarasov
            MODX Developer

            Email: [email protected]
            Web: antontarasov.com
            • 17546
            • 75 Posts
            Hello there !

            Is there a big problem / bug with FormIt and Output Filter, like :

            This code return the Message Error :
            <p>Validation Error Message : ([[!+fi.validation_error_message]])</p>
            


            But this, nothing !
            <p>Filter : ([[!+fi.validation_error_message:uppercase]])</p>
            


            These codes are in the same page !

            The result of these code are :
            Validation Error Message : (Le formulaire contient une ou plusieurs erreurs.)
            Filter : ()
            


            When I try to use If, like :
            [[!If &operator=`notempty` &subject=`[[!+fi.validation_error_message]]` &then=`<span class="error">[[!+fi.validation_error_message]]</span>`]]
            


            No result !, I think the +fi.* parsed wrong though' any other snippet (If / Output filter / ...)
            Any way to resolve this ?
              Low