]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes maxlength on IE on single line input element
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 31 Dec 2008 06:44:04 +0000 (06:44 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 31 Dec 2008 06:44:04 +0000 (06:44 +0000)
svn changeset:6377/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/ITextField.java
src/com/itmill/toolkit/tests/tickets/Ticket932.java

index f8a9a11347a027b7fc8857916e60eeaa3c7273be..0e342428e8eba071cc105ff1a8ccb7086f5bb26a 100644 (file)
@@ -105,7 +105,7 @@ public class ITextField extends TextBoxBase implements Paintable, Field,
             if (getElement().getTagName().toLowerCase().equals("textarea")) {
                 // NOP no maxlenght property for textarea
             } else {
-                getElement().setAttribute("maxlength", "" + maxLength);
+                getElement().setPropertyInt("maxLength", maxLength);
             }
         } else if (maxLength != -1) {
             if (getElement().getTagName().toLowerCase().equals("textarea")) {
index c0fd9c69bc02f3a6bc07b735ecf83f4fd21dce8d..728966f13b607f50a339a3eb2f5fddff54d82683 100644 (file)
@@ -16,10 +16,9 @@ public class Ticket932 extends Application {
         final Window mainWin = new Window("Test app for max length feature");
         setMainWindow(mainWin);
 
-        final TextField tx = new TextField("Textfield with maxlenght 10");
-        mainWin.addComponent(tx);
+        final TextField tx = new TextField(
+                "Textfield with maxlenght 10, single row");
         tx.setImmediate(true);
-        tx.setRows(5);
         tx.setMaxLength(10);
 
         final Label l = new Label();
@@ -35,6 +34,26 @@ public class Ticket932 extends Application {
 
         mainWin.addComponent(tx);
         mainWin.addComponent(b);
+
+        final TextField tx2 = new TextField(
+                "Textfield with maxlenght 10, multirow");
+        mainWin.addComponent(tx2);
+        tx2.setImmediate(true);
+        tx2.setRows(5);
+        tx2.setMaxLength(10);
+
+        Button b2 = new Button("Check value");
+        b2.addListener(new Button.ClickListener() {
+
+            public void buttonClick(ClickEvent event) {
+                l.setValue("Length: " + tx2.getValue().toString().length()
+                        + " Content: " + tx2.getValue());
+            }
+        });
+
+        mainWin.addComponent(tx);
+        mainWin.addComponent(b);
+
         mainWin.addComponent(l);
 
         final RichTextArea rta = new RichTextArea();