Tuesday, April 28, 2009

[jQuery] Re: [validate] - max validation with float values

Hey Jörn,

But how can that be done with the code I currently have implemented?

<script type="text/javascript">
$(document).ready(function() {
$("#commentForm").validate({meta: "validate"});
});

/Jesper

On 27 Apr., 14:14, Jörn Zaefferer <joern.zaeffe...@googlemail.com>
wrote:
> You need to add a custom method:http://docs.jquery.com/Plugins/Validation/Validator/addMethod
> And implement the validation for float values there.
>
> Jörn
>
> On Sun, Apr 26, 2009 at 8:01 PM, JesperDK <jespersoren...@gmail.com> wrote:
>
> > Hi all,
>
> > I use the validation fromhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
> > and have a problem with float values on the validation.
>
> > I have implemented the following on my page:
>
> > ..........
>
> > <script src="/admincustomers/js/jquery-1.3.2.min.js" type="text/
> > javascript"></script>
> > <script src="/admincustomers/js/validate/jquery.metadata.js"
> > type="text/javascript"></script>
> > <script src="/admincustomers/js/validate/jquery.validate.js"
> > type="text/javascript"></script>
> > <script src="js/validate/cmxforms.js" type="text/javascript"></script>
>
> > <script type="text/javascript">
> > $(document).ready(function() {
> >        $("#commentForm").validate({meta: "validate"});
> > });
> > </script>
>
> > ....................
>
> > <p>
> > <label for="camountreported">Redeem</label>
> > <input id="camountreported" name="amountreported" class="{validate:
> > {required:true,numberDE:true,max:6.06}}" />
> > </p>
>
> > The problem is that the user enters his values in 4, 5,25, 6,00 or
> > 6,05 etc.. (using the , sign) and the max validation only takes
> > integers.
>
> > How can I still make the max validation with the , sign and float
> > values? The users isn't allowed to submit the form if the value is
> > greater than the max value specifyed.
>
> > I hope some one can help me :-)
>
> > Thanks in advance.
>
> > /Jesper

No comments: