My problem is that when displaying the form as HTML, the attributes are being filtered in some way. For example, the attribute type is displayed as part of the markup but attributes like required and color are not. (Color is a dummy attribute I have created for testing purposes, but required is important as I want to use the HTML5 required behaviour.)

Here is the markup output for the specific field described in the XML above:

1 Answer
1

Though the XML file and the rendered HTML both call them attributes, there is not a direct pass through of values. Hence, only some attributes make it to the HTML (and some extra attributes are added).

So for every field, you specify a type, in this case text. This leads to the JFormFieldText class handling the rendering. JForm will call getInput on the field class to actually get back the input html. Glancing through this code, it should be very obvious why your custom attributes are not passed through: