Forums

Radio button issue

Basstrup 08 Oct, 2009
I don't know if this is a bug, so I might have posted in the wrong section. My apologies.

Working on a new site - so haven't verified my chrono license yet - I have a form on this page http://www.popsproductions.com/gary/registration.html

Originally the client wanted three questions - each to be answered yes or no

So I set up three questions individually with a Yes and No radio button, but setting each question to required only one radio button can be chosen at any given time? Is this the intended behavior. I had expected the behavior to be that an answer to one given question would be required. No? Eg. question one would require a yes or no, same for question two and three.

This is why I have the work around adding the fourth question. See the form using the link above. But it looks weird to me.

Secondly, and this is just due to my lack of knowledge, the client would like to verify that one of the questions has been answered "yes" - this of course applies when users can answer yes / no to the individual questions. Can that be done?
Mizpah 09 Oct, 2009
Hi Basstrup,

I have just taken a look at the source on your link, and have seen this:

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Did you attend one of Gary's workshops?</label>
    <div class="float_left">
      <input value="Yes" title="" class="radio validate-one-required" id="radio00" name="radio0" type="radio" />

      <label for="radio00" class="radio_label">Yes</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Have you participated in a group activity?</label>

    <div class="float_left">
      <input value="Yes" title="" class="radio validate-one-required" id="radio00" name="radio0" type="radio" />
      <label for="radio00" class="radio_label">Yes</label>
      <br />


If you look at your <input> taggs for each radio button, you will see that the 'id' and 'name' is the same for different questions. As such, the form thinks there is only one question, and is only allowing you one responce across all of your radio buttons.

You need to name them uniquely, somthing like:


<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Did you attend one of Gary's workshops?</label>
    <div class="float_left">
      <input value="Yes" title="" class="radio validate-one-required" id="radio00" name="radio0" type="radio" />
      <label for="radio00" class="radio_label">Yes</label>
      <br />
<input value="No" title="" class="radio validate-one-required" id="radio01" name="radio0" type="radio" />
      <label for="radio01" class="radio_label">No</label>
      <br />
    </div>
  </div>
  <div class="cfclear"> </div>
</div>
<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Have you participated in a group activity?</label>
    <div class="float_left">
      <input value="Yes" title="" class="radio validate-one-required" id="radio10" name="radio1" type="radio" />
      <label for="radio10" class="radio_label">Yes</label>
      <br />
<input value="No" title="" class="radio validate-one-required" id="radio11" name="radio1" type="radio" />
      <label for="radio11" class="radio_label">No</label>
      <br />
    </div>
  </div>
  <div class="cfclear"> </div>
</div>


As to verifying if a yes has been answered, there are a several ways of doing it, what are you trying to achieve ?
This topic is locked and no more replies can be posted.