[formfields] set a reasonable minimal minimum length to input/text, also set the max length if applicable (closes #344538)
--- a/web/formfields.py Thu Jul 09 11:55:47 2009 +0200
+++ b/web/formfields.py Thu Jul 09 12:06:14 2009 +0200
@@ -203,6 +203,11 @@
widget = Select()
elif self.max_length and self.max_length < 257:
widget = TextInput()
+ maxlength = self.max_length or 45
+ widget.attrs.setdefault('size', min(45, maxlength))
+ if self.max_length:
+ widget.attrs.setdefault('maxlength', self.max_length)
+
super(StringField, self).init_widget(widget)
if isinstance(self.widget, TextArea):
self.init_text_area(self.widget)