We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8822
    • 203 Posts
    Hi Everyone, i have implemented some forms using FormIt and everything works great, except for the fact that when i come to validate it using the Markup Validation Service (www.http://validator.w3.org/) i get the following validation error

    there is no attribute "value"

    The odd thing is, is that the same syntax validates elsewhere in the form. For example: The error message is thrown against the syntax:

    <select name="dob-day" tabindex="3" class="forminputs [[!+fi.error.dob-day:notempty=` error`]]" id="dob-day" value="[[+fi.dob-day]]">


    but not against the syntax

    <select name="dob-month" tabindex="4" class="forminputs [[!+fi.error.dob-month:notempty=` error`]]" id="dob-month" value="[[+fi.dob-month]]">


    Any ideas? [ed. note: Emily last edited this post 14 years, 4 months ago.]
      • 27708 MODX Staff
      • 2,502 Posts
      Are you testing on the form output or is your FormIt markup unprocessed? What is the output in the browser for this form? Your FormIt calls pre-processed may not work in the validator. Also it is my experience that the validator is like a spell checker in that it may not be 100% accurate per the spec.
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 8822
        • 203 Posts
        I am testing on the form output.

        The output that fails validation looks like this:

        <select name="dob-day" tabindex="3" class="forminputs " id="dob-day" value="">


        and the output that passes looks like:

        <select name="dob-month" tabindex="4" class="forminputs " id="dob-month" value="">


        They look the same to me, which is why i can't figure out why some instances are failing?
          • 27708 MODX Staff
          • 2,502 Posts
          I really shouldn't answer posts before coffee. wink

          There is no value attribute for a select. It should fail in all cases. Only option element has a value attribute. The valid attributes for select are shown here: http://www.w3.org/TR/html-markup/select.html

            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 8822
            • 203 Posts
            aaah yes, absolutely right - should have spotted that - sorry to waste your time, was getting confused with the fact that some instances appear to validate ok !!

            It would appear that the above is also true for textarea which brings me to another question, when i validate my form prior to submission all drop downs and input field values are retained should validation fail, but anything inside a textarea field are lost, The code i am using for a text area is:

            <td align="left" ><textarea name="familydob" cols="40" rows="3" tabindex="15" class="forminputs" id="familydob"></textarea></td>


            Any ideas?
              • 8822
              • 203 Posts
              Solved !!!

              It would appear textareas are different to text input fields and need the syntax:

              <td align="left" ><textarea name="familydob" cols="40" rows="3" tabindex="15" class="forminputs" id="familydob">[[!+fi.familydob]]</textarea></td>


              Thanks for your help smiley
                • 27708 MODX Staff
                • 2,502 Posts
                Cool. Glad you sorted it out. Cheers.
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub