Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= submit_tag 'Submit', :onclick => 'return validate(this)' %><br/>
- <script type="text/javascript" charset="utf-8">
- function validate() {
- var valid = false;
- var radio_groups = {}
- $(":radio").each(function(){
- radio_groups[this.name] = true;
- })
- for(group in radio_groups){
- if (!!$(":radio[name="+group+"]:checked").length) {
- valid = true;
- }
- }
- if (!valid) {
- alert('you forgot to check a radio button somewhere');
- return false;
- }
- }
- </script>
Add Comment
Please, Sign In to add comment