Validating radio buttons with javascript dating mitchell 300 reels

when submit button is pressed and no radio buttons have been selected, it alerts the user saying 'please select a check box', and if a radio button has been selected then simply submit the form, needs no alert.Can only use HTML CSS and Java Script for this, I know it's 1000 times easier in jquery but sadly I can't use that. Having a few issues and cannot see a way to actually do the following.ive duplicated a simple questionnaire as shown here: there are 8 questions, each with 8 possible answers.See HTML5: How to use the "required" attribute with a "radio" input field for more information on how to do this well. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).Would you like to answer one of these unanswered questions instead?Each row of the answers has its own name ie: question12_answer1 - question12_answer8 and each of those has a value of 1 - 8 an example bit of code is: Basically, what im trying to do is this: on form submit i want to run a bit of code(already got this set up) so that I can validate if only one answer 1 has been selected, one answer 2 and so on.So 1 can only be used once, 2 can be used only once, all the way to 8. Having a few issues and cannot see a way to actually do the following.

I would change the line if (radios[i].checked) form Valid = true; to if (radios[i].checked) so it becomes true with the value of the checked item. Also, always use braces, even if there is just one item.I just can't see a way to even begin this to be honest. ive duplicated a simple questionnaire as shown here: there are 8 questions, each with 8 possible answers.So 1 can only be used once, 2 can be used only once, all the way to 8.The creation of multiple groups of radio buttons for the one form is also straightforward.All you need to do is to provide the second group of radio buttons with a different name to that used for the first group.

Leave a Reply