Validating Checkboxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miguel Orrego

    Validating Checkboxes

    Hi,

    I have a form that is created dynamically from a recordset, this creates a
    line for each record together with 2 checkboxes, Yes & No so the source
    output would be something like this:

    <p>Please indicate whether you still use each piece of software detailed
    below:</p>
    <form name="apps" method="POST" action="MyActio n">
    <table width="600" border="1" cellspacing="0" cellpadding="5" >
    <tr bgcolor="#9999F F">
    <td><font color="#FFFFFF" ><strong> Software</strong></font></td>
    <td><font color="#FFFFFF" ><strong>Requir ed?</strong></font></td>
    </tr>

    <tr>
    <td>Adobe Photoshop 7.0 7.0</td>
    <td><input type="checkbox" name="Yes" value="Adobe Photoshop 7.0 7.0">
    Yes
    <input type="checkbox" name="No" value="Adobe Photoshop 7.0 7.0">
    No </td>
    </tr>

    <tr>
    <td>Citrix ICA Client</td>
    <td><input type="checkbox" name="Yes" value="Citrix ICA Client">
    Yes
    <input type="checkbox" name="No" value="Citrix ICA Client">
    No </td>
    </tr>

    <tr>
    <td>Macromedi a Dreamweaver MX 6.0</td>
    <td><input type="checkbox" name="Yes" value="Macromed ia Dreamweaver MX
    6.0">
    Yes
    <input type="checkbox" name="No" value="Macromed ia Dreamweaver MX
    6.0">
    No </td>
    </tr>
    </table>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </form>

    And so on......

    I want to ensure that either Yes or No has been checked for each line before
    the form can be submitted, how can this be done through javascript? The
    amount of lines in the form will vary.

    Thanks.


  • Lee

    #2
    Re: Validating Checkboxes

    Miguel Orrego said:
    [color=blue]
    >I want to ensure that either Yes or No has been checked for each line before
    >the form can be submitted, how can this be done through javascript? The
    >amount of lines in the form will vary.[/color]

    Use radiobuttons instead of checkboxes. Default them all to "no".

    Comment

    Working...