I am using the Primefaces inputMask for formatting of phone numbers. However this component does not support the HTML5 pattern attribute, and therefore does not cause the iOS numeric keypad to appear.
I would like the resultant output to look somewhat like
<input type="text" pattern="\d*"/>
I have tried using javascript to write the pattern attribute on page load, but couldn't get that to work (e.g.)
$(document).ready(function() {
$("#userPhDay").pattern="\d*";
});
I was toying with the idea of using the above html5 input and then onchange the results into a h:inputHidden. Another option is to create my own tag library on top of primefaces that implement this.
I have found that BalusC (my favourite reference on all things JavaEE) has covered this for Omnifaces in his blog article http://balusc.blogspot.com.au/2012/06/adding-html5-attributes-to-standard-jsf.html. He went down the road of a custom renderer. I think Balus would answer this question by saying that I should use Omnifaces in addition to Primefaces.
What have others done to present the numeric keypad on mobile devices from JSF?
Cheers, Ed.