Social Icons

twitterfacebooklinkedinbehancerss feedemail

Tuesday, April 16, 2013

Why does jQuery Tools Validator Treat Radio Buttons As Required By Default

Why does jQuery Tools Validator Treat Radio Buttons As Required By Default?

If you've been using HTML5's form features, you'll know that you can handle form validation natively within the browser thanks to the required attribute. During a recent project using and old version of jQuery Tools Validator, I came across a unique issue in which the validator would automatically validate radio buttons even if they are not set as required.

The issue: How to prevent validation on radio buttons that are not set as required?

Some background: 
In HTML5, the way to make a field mandatory is to set the required="required" attribute on it. For radio buttons, you're supposed to add that to the first radio button in a group to make it mandatory.
The issue is if you need radio buttons to be optional, they should be this way by default if you didn't set the "required" attribute.

Without using jQuery Tools Validator, it functions properly as an optional radio button group.

Once jQuery Tools Validator is turned on, it forces the radio buttons to be mandatory.


The quick and lazy solution: If your radio buttons are a simple Yes and No question, then decide on a default value and set that one as checked in your html. This will prevent the validation on the radio buttons but is not the most practical of solutions.

Proposed solution by the people on github who originally reported this issue:  













Note: This issue appears to be fixed in the latest issue of jQuery Validator

Check out this thread: https://github.com/jquerytools/jquerytools/issues/733

14 comments:

  1. A very inspiring post as well as inspiring taught thus, I really appreciate it! Thanks

    Searchinfomedia.

    ReplyDelete
  2. Totally inspired, congratulations for doing best to keep things interesting. Learning many new topics from the blog, maybe keep an eye on it!

    http://www.hookheathwebdesign.com/

    ReplyDelete
  3. Great article along with impressive matter you shared here. These are truly resourceful; I would recommend these collections on my social group. Keep writing …. Will put a trackback to your Blog to get more exciting stuff at one place.

    For more details: http://www.hookheathwebdesign.com/

    ReplyDelete
  4. Each time
    I used to always check blog posts within the first hours in the break of day,
    because I like to get information increasingly more.

    Buy Backlinks Birmingham

    ReplyDelete
  5. Thanks
    for sharing the useful information with us..Keep going

    purvakara westend

    purvakara westend bangalore

    ReplyDelete
  6. I am glad to read this post, its
    an interesting one. I am always searching for quality posts and articles

    *



    purva palm beach

    ReplyDelete
  7. This nice and
    helpful blog....Thanks for this post, Thanks for posting this instructive
    blog...well done.



    prestige royal gardens , prestige royal gardens bangalore, and
    prestige royale gardens

    ReplyDelete
  8. Webzin Infotech offers a well developed website can simplify the process of message consumption, quicker interaction and internet transactions resulting in good Return On Investment.
    web development India

    ReplyDelete
  9. Webzin Infotech provides ecommerce solutions tailored to your specific business needs! We are a one stop shop for all your ecommerce requirements!
    website design India

    ReplyDelete
  10. Very Good post!
    I would definitely recommend this blog to my friends who are into good content.
    Keep doing work like. Thanks a lot!

    ReplyDelete
  11. Those are really informative tips. Thank you for sharing such an insightful stuff. Keep blogging, It’s a great experience to spend time to read and learning many new topics from your blog. Excessive work! I’ll wait to see such post further.
    http://mediamovers.com.au/

    ReplyDelete
  12. Wow…. Interesting insights on your blog. I have found something useful on your site. Thanks for the knowledge and ideas shared with us, definitely bookmarking this one.

    http://lasercap.com/

    ReplyDelete

ShareThis

 

What We Do...

Queens Web Design and Graphics is a web and graphic design company in Queens, NY specializing in providing local businesses with affordable websites offering design, animation and multimedia services. Learn More...