maxSize validation for <g:textarea ... />
when grails creates view, it automatically adds a maxLength
attribute to text fields. This is great because users will not be able to input a string which is longer than the contraint. This h开发者_如何学运维elps to avoid getting an error message...
however, if you try the same with a textarea, grails will not place such a contraint in the html code. I know: html has no maxLength for textareas. But there are many javascript based solutions out there which even show how many characters are left...
Does anybody know of a plugin which adds this feature?
PS: I am speaking of Grails 1.3.7 - don't know if a newer version already implements this.
I don't know of a Grails plugin that does this. There are many JQuery plugins that provide this feature, but if you use one of those you'll need to devise some mechanism for keeping the domain constraints in synch with the JavaScript (or do it manually).
精彩评论