You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Attila Király (JIRA)" <ji...@apache.org> on 2011/04/19 21:18:06 UTC
[jira] [Updated] (WICKET-1310) StringValidator.maximumLength should
automatically add maxlength html attribute
[ https://issues.apache.org/jira/browse/WICKET-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Attila Király updated WICKET-1310:
----------------------------------
Attachment: WICKET-1310.patch
In the upcoming 1.5 StringValidator extends Behavior so it would be a nice addition to have this feature now.
Attaching a patch against current trunk that modifies ExactLengthValidator, LengthBetweenValidator and MaximumLengthValidator so they add automatically a "maxlength" attribute to the attached component's tag.
By default they will only add it to "input" tags but with a special constructor this restriction can be lifted. This can be useful because in Html5 textarea has "maxlength" attribute too.
> StringValidator.maximumLength should automatically add maxlength html attribute
> -------------------------------------------------------------------------------
>
> Key: WICKET-1310
> URL: https://issues.apache.org/jira/browse/WICKET-1310
> Project: Wicket
> Issue Type: Improvement
> Affects Versions: 1.3.1
> Reporter: Ryan Sonnek
> Assignee: Johan Compagner
> Priority: Minor
> Attachments: WICKET-1310.patch, patch.txt
>
>
> Validating max length of strings should not require a round trip to the server. adding the html attribute to forms will prevent data entry on the client side.
> I'm manually doing this as part of the wicketstuff-hibernate project, but it would be great to just have this built into wicket.
> http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-stuff/trunk/wicketstuff-hibernate-behavior/src/main/java/org/wicketstuff/hibernate/annotation/HibernateAnnotationComponentConfigurator.java?view=markup
> I understand that currently validators can be used independently of Wicket and don't know about components or behaviors, but i'm recommending this be changed. Wicket is a *web framework*, not a *validation library*. If i want a portable validation library, I'll use commons-validation, not wicket. So, the validators should be *web validators* and be able to modify components or render custom javascript to help with web validation.
> FYI: tapestry does it! =)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira