Sorry, but I have to change that code, because it had a mistake.

If you had disabled the JavaScript, the server validation thowed an
exception, caused by adding the "maxlength" parameter, I don't know exactly
why!!

It was necesary for client validation, so Whath could I do?

I have edit the validator-rules.xml, to change the name of the parameter
that client validator looks for.
I have change it from maxlength to max, so now I use the same parameter to
server and client validation.

The part of the validator-rules.xml I have change is:

<validator name="maxlength"
            classname="org.apache.commons.validator.GenericValidator"
               method="maxLength"
         methodParams="java.lang.String,int"
              depends=""
                  msg="errors.maxlength">
[...]
                        var iMax = parseInt(oMaxLength[x][2]("max"));
[...]
</validator>

And my code now is:


Now my code is:

<h:inputTextarea styleClass="text medium" id="description"
        value="#{subsystemForm.subsystem.description}" required="true"
        maxlength="1500" cols="80" rows="10">
        <v:commonsValidator type="required"
                arg="#{text['subsystem.description']}"
                server="true"
                client="true"/>
        <v:commonsValidator type="maxlength"
                arg="#{text['subsystem.description']}"
                max="1500"
                server="true"
                client="true"/>
</h:inputTextarea>


-- 
View this message in context: 
http://www.nabble.com/v%3AcommonsValidator-maxlength-tp18867067p18888006.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to