Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maxlength for GWT TextArea

Tags:

gwt

I am unable to set the maximum length for a GWT TextArea. Could someone help me achieve this in GWT?

TextArea t1 = new TextArea();
t1.setMaxLength(300); // This method doesn't exist. How do I do this?
like image 610
Delli Kilari Avatar asked Aug 08 '11 10:08

Delli Kilari


2 Answers

Gal's answer is right with just one correction :

t1.getElement().setAttribute("maxlength", "100");

The second parameter is a string. This worked for me.

like image 162
Mahesh More Avatar answered Sep 24 '22 07:09

Mahesh More


You can set it as such:

t1.getElement().setAttribute("maxlength", "100");
like image 43
Gal Bracha Avatar answered Sep 26 '22 07:09

Gal Bracha