You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

New jQuery Tool released: Validator Created May 4, 2010

This thread is solved

Views: 4748     Replies: 15     Last reply Dec 1, 2011  
You must login first before you can use this feature

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

New jQuery Tool released: Validator

Posted: May 4, 2010

"HTML5 input validation for humans"

Let me know what you think.

Enjoy!

listingwarebob

Posts: 5

Registered:
May 5, 2010

Checkbox Validation?

Posted: May 5, 2010

Reply to: New jQuery Tool released: Validator, from tipiirai
I just tried to use Validator on a checkbox field. Should this work?

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» Checkbox Validation?

Posted: May 5, 2010

Reply to: Checkbox Validation?, from listingwarebob
to be honest I have never tried it. what kind of validation you are using? the required attribute?

listingwarebob

Posts: 5

Registered:
May 5, 2010

Checkbox Validation

Posted: May 5, 2010

Reply to: » Checkbox Validation?, from tipiirai
Yes. All I did was add required="required" to it. Other fields in the form are working for text, email, and password inputs. You can see it here:

http://vacationistas.com/register.cfm

That was the first form I tried to convert to Validator. The checkbox is there, but it doesn't seem to have any effect.

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» Checkbox Validation

Posted: May 5, 2010

Reply to: Checkbox Validation, from listingwarebob
yea. can see it. will have to fix it on 1.2.1. It will take a week or two. Thanks!

emiyasaki

Posts: 2

Registered:
May 9, 2010

» » Checkbox Validation

Posted: May 9, 2010

Reply to: » Checkbox Validation, from tipiirai
Is there a way to make it work for SELECTs also?

I have one or two forms using them and are the only ones I didn't convert to Validator yet.

Thanks for this great tool!

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » Checkbox Validation, from emiyasaki
what kind of validation you'd expect for SELECT inputs? the required attribute?

emiyasaki

Posts: 2

Registered:
May 9, 2010

» » » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » » Checkbox Validation, from tipiirai
Hi Tero,

Sorry for the delay.

Most of the times we use the OPTION's value attribute as a numeric value, starting with '0'. Maybe 'min' could be extended to the SELECT validation.

Thanks!

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » » » Checkbox Validation, from emiyasaki
validator attempts to play in sync with the HTML5 standard. I believe that min attribute is not valid for SELECT element.

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » Checkbox Validation, from emiyasaki
I've now implemented requred attribute for select and checkbox fields. Will be out in 1.2.1.

Sylvain

Posts: 1

Registered:
May 10, 2010

» » » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » » Checkbox Validation, from tipiirai
Hi Tero,

First of all, thanks for the amazing works you've done so far with this plugin !

I just tried to use Validator on some of my forms.
And i have two questions :
- Is it possible to implement a required attribute for a group of radio fields to check that at least one is checked ?
- When i put a pattern attribute on a field, the validation act like this field is required even if there is no required attribute on it. Is it possible to allow empty fields with a pattern attribue ?

Thanks a lot !

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » » » Checkbox Validation

Posted: May 10, 2010

Reply to: » » » » Checkbox Validation, from Sylvain
1. I suggest you put a checked attribute to one of your radio fields by default. then user is forced to pick up one.

2. you should make such pattern that it allows empty values. use pattern characters such as ? or *

thank you for the kind words.

JasonH

Posts: 2

Registered:
May 17, 2010

select validation

Posted: May 17, 2010

Reply to: » » Checkbox Validation, from emiyasaki
This will only work if the default option has no value or is set to "". Add class="optionrequired" to your select and then

$.tools.validator.fn(".optionrequired", function(input, value) {
	return value.length >= 1 ? true : {     
		en: "Please make a selection"
	};
});

Hopefully this will help somebody...

-Jason

kevinsky

Posts: 2

Registered:
Oct 14, 2010

> select validation

Posted: Oct 14, 2010

Reply to: select validation, from JasonH
Hi Everyone,

i'd also like to say thanks for these superb jquery tools! i really appreciate the effort put into them and documentating them so well too!

here just a little note for the validation of <selects> when comparing with a specific value ( here 0 ), as asked above:

$.tools.validator.fn("#my_select", function(input, value) {
	return value != 0 ? true : {     
		en: "Please make a selection"
	};
});

kind regards - kevinsky