Custom HTML tag attributes are not rendered by JSF -


i want add ios specific tag attributes login-form. if have on web page source, attributes autocorrect, autocapitalize , spellcheck aren't there. reason this? using jsf 2.x.

<h:inputtext id="user-name" forceid="true" value="#{login.username}" style="width:120px;"     autocorrect="off" autocapitalize="off" spellcheck="false" /> 

this design. can specify attributes supported jsf component (i.e. it's listed in attribute list in tag documentation). can't specify arbitrary additional attributes, plain ignored.

there several ways solve this:

  1. if you're on jsf 2.2+, specify passthrough attribute:

    <html ... xmlns:a="http://xmlns.jcp.org/jsf/passthrough"> ... <h:inputtext ... a:autocorrect="off" /> 

    (note i'm using xmlns:a instead of xmlns:p avoid clash primefaces default namespace)

    or:

    <html ... xmlns:f="http://xmlns.jcp.org/jsf/core"> ... <h:inputtext ...>     <f:passthroughattribute name="autocorrect" value="off" /> </h:inputtext> 

  2. use omnifaces html5renderkit. since 1.5 release, supports specifying custom attributes <context-param>. see showcase example or javadoc.


  3. create custom renderer. can find several concrete examples in below answers:


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -