-6

URl - http://www.getcsr.com/index.php/264-2/ I want the user to atleast answer one option for each question

chiragvora
  • 23
  • 2
  • 9
  • What's the problem with your current solution? (And why didn't you post it?) – Felix Kling Jul 11 '14 at 07:48
  • I have created a survey form, Now I want the users to select atleast one option for each question and then submit the survey. Currently what is happening is without answering any options, the form gets submitted. So how to validate it? so that if say 4 out of 5 questions are answers then it should pop up that that particular question isn't answered and the response shouldn't be submitted till that time. – chiragvora Jul 11 '14 at 08:40
  • See [Validate multiple checkbox groups](http://stackoverflow.com/q/8273577/218196) and [JavaScript, How can I check whether a radio button is selected?](http://stackoverflow.com/q/1423777/218196) – Felix Kling Jul 11 '14 at 08:45

1 Answers1

0

Add required attribute to at least one input of radio group. Make sure each group has it's own name (at the moment all your radio groups have same name: name="question").

<input name="question1" type="radio" required value="Positive">Positive<br>
<input name="question1" type="radio" value="Negative">Negative<br>
<input name="question1" type="radio" value="Neutral">Neutral</span>
mayr
  • 451
  • 6
  • 14
  • Not like that, user can choose anyone of the option. It isn't compulsory that user have to select that particular option. It is only necessary that user should select atleast and only one option per question or else a popup message should come. – chiragvora Jul 11 '14 at 08:41