Permalink
Browse files

Add maxlength attribute to submit form title field.

  • Loading branch information...
1 parent d7644b8 commit 09b0be25833486c5fe3226f8090474d80eff3b6b @chromakode chromakode committed with spladug Dec 5, 2012
Showing with 5 additions and 3 deletions.
  1. +3 −2 r2/r2/controllers/validator/validator.py
  2. +2 −1 r2/r2/templates/newlink.html
View
5 r2/r2/controllers/validator/validator.py
@@ -529,8 +529,9 @@ def run(self, text, text2 = ''):
class VTitle(VLength):
- def __init__(self, param, max_length = 300, **kw):
- VLength.__init__(self, param, max_length, **kw)
+ max_length = 300
+ def __init__(self, param, **kw):
+ VLength.__init__(self, param, self.max_length, **kw)
def param_docs(self):
return {
View
3 r2/r2/templates/newlink.html
@@ -24,6 +24,7 @@
from r2.lib.strings import strings
from r2.lib.pages import UserText
from r2.lib.template_helpers import add_sr
+ from r2.controllers.validator import VTitle
%>
<%namespace file="utils.html" import="error_field, submit_form, _a_buffered, reddit_selector, text_with_links"/>
@@ -59,7 +60,7 @@
<div class="spacer">
<%utils:round_field title="${_('title')}" id="title-field">
- <textarea name="title" rows="2" required>${thing.title}</textarea>
+ <textarea name="title" rows="2" maxlength="${VTitle.max_length}" required>${thing.title}</textarea>
${error_field("NO_TEXT", "title", "div")}
${error_field("TOO_LONG", "title", "div")}
</%utils:round_field>

0 comments on commit 09b0be2

Please sign in to comment.