This content has been marked as final.
Show 2 replies
-
1. Re: how to rewrite user input in h:inputText
pvito Jan 20, 2012 2:56 AM (in response to kamal_khadka)Hi, Kamal
You may use jQuery Masked Input Plugin: http://digitalbush.com/projects/masked-input-plugin
Regards, Vitaliy
-
2. Re: how to rewrite user input in h:inputText
kamal_khadka Feb 6, 2012 1:57 PM (in response to pvito)1 of 1 people found this helpfulThe way I fixed this for me is
before
<h:inputText value="#{entity.phone}"/>
---------------------------------------------------------------------------------------------------------
now
<h:inputText value="#{helper.phone}"/>
and in helper.java
String tempPhone = "";
public void setPhone(String phone)
{
tempPhone = phone.replaceAll("\\D", "");
tempPhone = tempPhone.substring(0, 3)+ "-" + tempPhone.substring(3, 6) + "-" + tempPhonee.substring(6, 10);
entity.setPhone(tempPhone)
}
public String getPhone()
{
return entity.getPhone();
}