Two Laptop Bag
The moose likes JSF and the fly likes JSF inputTextarea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF inputTextarea" Watch "JSF inputTextarea" New topic

JSF inputTextarea

Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
Hi All,
I am using h:inputTextarea. I want to fixed the content to 256 characters. I used the property maxlength but it is not working. My code is:

Please help me.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

There are 3 things that determine the browser characteristics of an inputText field, and they are the same as those for the regular HTML INPUT tag, since that's what gets generated.

The maxlength attribute determines the maximum number of characters that the field will be allowed to hold. Once that limit is reached, the browser should refuse to accept any more, and might even flash or beep or something to provide user feedback. Whether it does any of the preceding is dependent on what brand and version of browser is being used.

The size attribute estimates the physical size of the displayed text control based on character count. size can be less than, equal, or greater than maxlength. It will not control what the user can input - if maxlength is enforced, you might have plenty of free space in the control, but the browser would refuse to accept text. Conversely, the text may not all be visible if the size attribute is smaller than the amount of text in the control. My experience has been that size is only approximate in my favorite browsers, but for variable-width fonts, it would have to be.

The CSS width property also can control the displayed size, but more precisely.

An IDE is no substitute for an Intelligent Developer.
Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
Thanks Tim. But the solution with the code will be more welcome. Please help.
I agree. Here's the link:
subject: JSF inputTextarea
It's not a secret anymore!