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

17 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 posting this helpful
    blog...well done!!!!



    prestige sunrise park and

    prestige sunrise park
    bangalore

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

    purvakara westend

    purvakara westend bangalore

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

    *



    purva palm beach

    ReplyDelete
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. GCC Web hosting makes your website accessible online in a flash. Our state-of-the-art UAE Hosting services offer you the best, most secure, reliable and powerful solution for your business needs. Whether you are an independent user or have a small business or large enterprise, we provide suitable solution for your demands. Security and Reliability are basic features of our web hosting services.

    ReplyDelete
  15. Nice overview! I really get much more information to this post and feel obligated to leave a comment. Will bookmark this post and visit regularly to get more. Great job, Congrats!!

    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...