We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13730
    • 149 Posts
    Hi

    Modx 2.2.10
    Formit : 2.2.0
    HTML 5

    Question is about W3C validation for Formit with attachment.

    My form is working very well. It is about his W3C validation

    From my form :
    <p><label for="document">Joindre votre CV (Word ou PDF)
    </label><span class="error">[[!+fi.error.document]]</span> <input type="file" id="document" tabindex="3" name="document" value="[[!+fi.document]]"></p>

    From W3C Validation Service
    Validation Output: 1 Error
    Line 299, Column 169: Attribute value not allowed on element input at this point.
    …n> <input type="file" id="document" tabindex="3" name="document" value=""/></p>


    If I remove « value="[[!+fi.document]]" » the form still working perfectly and it pass the W3C validation.

    My question, can I remove « value="[[!+fi.document]]" » without causing any problem or it is mandatory?

    Thanks [ed. note: jber last edited this post 12 years, 10 months ago.]
      • 3749
      • 24,544 Posts
      Yes, an input field of that type can't have a value attribute, so removing it should be fine. The only annoyance is that if there's an error and the form doesn't submit, the user may have to re-select the file. JavaScript validation could prevent that from happening.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 13730
        • 149 Posts
        Thank you for your reply Bob Ray.
          • 3749
          • 24,544 Posts
          Glad I could help. smiley
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting