JSF inputText required attribute does not render - html

On JBoss AS 7.1.1 using Moharra JSF 2,
an XHTML file created with an inputText element will not render the attribute required="true".
No errors but the output HTML does not contain the required attribute. If writing pure HTML input element the required attribute renders as part of the JSF form.
Anyone know why this attribute would be stripped out?
The case is a container managed login form so there is no backing bean. Many thanks in advance.

That's expected behavior, that attribute is not for the HTML input tag, but for the required attribute of the UIInput component that stays on the server side.
See these related questions:
JSF 2.0 strips out needed HTML5 attributes
Adding custom attribute (HTML5) support to JSF 2.0 UIInput component

Related

Is it possible to use custom elements with .Net Web Forms controls?

When creating a custom element with a '-' in the tag name and using the attribute runat="server", the server tag is not well formed error appears when loading the page.
This is using Asp.Net 4.7. When you remove the hyphen in the tag, you have no issues or if you remove the runat="server" you have no issues.
<depth-chart runat="server" ></depth-chart>
I would expect this to run as is but .NET is not having that hyphen, a requirement for a custom element to be recognized by the browser. I'd like to be able to keep the dash and the runat attribute so that this custom element can be fiddled with on the .ascx and the .ascx.cs.
I ended up solving this by working around the parser on the .ascx file.
In the .ascx.cs file you can create a generic element with you own custom tag and the parser will not complain.
HtmlGenericControl depthChart = new HtmlGenericControl("depth-chart")
I added this control to the front with a <asp:Placeholder> as the parent.

Does Primefaces render invalid HTML?

To build a very simple web app for my company I'm evaluating some web frameworks, including PrimeFaces.
One strict requirement is the accessibility, and the fact that the HTML must be valid (checked against W3C Validator).
I've played a bit with the examples and I've noticed that the HTML rendered is not valid. The invalid block is the following:
<input name="javax.faces.ViewState" id="javax.faces.ViewState" value="2042368857675116551:8104174386673838460" autocomplete="off" type="hidden">
and the reason is:
line 74 column 159 - Errore: Attribute autocomplete not allowed on element input at this point.
So, can I perform some action on Primefaces in order to render valid HTML code? I didn't go deep into Primefaces, but I guess I have little control over how controls are rendered. Has anyone experience on this problem (validity of HTML rendered by PF) and would like to share it?
Thanks
The viewstate is not something that PrimeFaces adds to your rendered html but the jsf implementation. If you use mojarra there are some parameters that you can set to tune things (not tested this myself, just did some simple googling for you (hint, hint)).
See in How to let JSF render conform XHTML 1.0 strict?

What is the usage of Angular directive novalidate in a form html tag

I wanted to understand the meaning of novalidate directive usage in form tag, especially when used to validate the form.
Thanks
It prevents the browser's native validation to kick in i.e form data will not be validated upon submission. Examples include input where type='email'
Note that it is not Angular's directive. It is HTML 5 attribute. Read more about it here
novalidate attribute is used to disable browser's native form validation.
You can use it when you need do your own AngularJS custom validation.
You can use the same ones used by the HTML 5 specification in Angular,so you can add the novalidate attribute to the form element, which tells the browser not to use its native validation. Because different browsers have different implementation validations. Since Angular get validation itself, the browser don't need to do validation implementation.

How to make Netbeans recognize custom HTML attributes?

In netbeans (7.1.2) when adding a custom attribute to an HTML element, for example data-dismiss="modal I get a warning 'data-dismiss not allowed on element...'. Is it possible to add custom HTML attributes to Netbeans, making it aware of these attributes and not give a warning?
I've looked thoroughly through all menu options and configuration. I would expect something like 'add attribute to dictionary'

Knockout.js data-bind attribute causes html validation warning

I'm using the HTML Validator firefox add-on and when I go to the home page of http://knockoutjs.com/, I get warnings about the data-bind attribute (for the Live Example):
Examples:
<select> proprietary attribute "data-bind"
<button> proprietary attribute "data-bind"
I also get errors regarding the data-bind attribute when submitting the URL at http://validator.w3.org/.
I know this html attribute is used by knockout.js to do some data binding, but can we conclude that this approach does not follow the HTML specification? Does knockout.js follow the spirit of valid HTML markup?
They are HTML 5 custom attributes. Try to validate against HTML 5 specs and you should get an ok on the validation.
But since long you have been able to use custom attributes as you see fit although it may have violated strict HTML 4 specs.