开发者

maxlength for JSF TextArea

开发者 https://www.devze.com 2023-03-11 14:40 出处:网络
I am using <h:inputTextarea maxlength=\"50\" /> I already have a javascript inplace where it will read the maxlength and only allow 50 characters (in开发者_如何学Go our example) it works fine wi

I am using <h:inputTextarea maxlength="50" /> I already have a javascript inplace where it will read the maxlength and only allow 50 characters (in开发者_如何学Go our example) it works fine with textarea but not with h:inputTextarea.

thanks


h:inputTextarea doesn't support the maxlength attribute:

http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/h/inputTextarea.html

The html textarea element doesn't have that property prior to html5 which is why it's not supported. You can of course validate the length with a jsf validator to enforce the max size server side and as you are already doing use javascript to limit the input for those clients that support js.

0

精彩评论

暂无评论...
验证码 换一张
取 消