troubleshooting Question

Radio Buton - SQL DB Field Type - Checkbox DB Field Type.

Avatar of koila
koilaFlag for Australia asked on
Microsoft SQL ServerColdFusion Language
8 Comments1 Solution986 ViewsLast Modified:
I have this test form.  I would like to insert the data into a SQL Table.  I wold like to re-design the SQL Table.  Please help me on the Field type for YES  NO then for the checkbox.

I would like to create a SQL Table.

Into my design, for question 1 which field structure I should have for a radio button and how many field I should have for a checkbox button and type please.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<html>
<head>
<title>Form | </title>
</head>

<script type="text/javascript">
// checks buttons (radio, checkbox) - coursesweb.net
function checkButons(frm) {
var re = false;           // used to determine when a button is checked
var err = '';             // to store the errors

var question1 = frm.contactme;          // contains an array with all radio buttons "vegetable"

// create an Array in JSonn format with checkbox buttons
var question2 = [frm.CMTEE_PREF_NEW];

// traverse the radio buttons
// if one is checked sets re to true, and stops the iteration with "break"
for(var i=0; i<question1.length; i++) {
  if(question1[i].checked == true) {
    re = true;
    break;
  }
}

// if "re" is false means no radio button checked, add error in "err" 
if(re == false) err += '- You must check at least one vegetable';

// make "re" again False, and traverse the checkbox buttons
// if one is checked sets re to true, and stops the iteration with "break"
re = false
for(var i=0; i<question2.length; i++) {
  if(question2[i].checked == true) {
    re = true;
    break;
  }
}

// if "re" is false means no checkbox button checked, add error in "err" 
if (re == false) err += '\n - You must check at least one fruit';

// if "err" not empty, alert the error(s) and returns False to stop submitting form
if(err != "") {
  alert(err);
  return false;
}
else return re;
}
--></script>


<body>
<cfform id="f1" name="f1" action="confirmationn_e.cfm" method="POST" onsubmit="return checkButons(this);">
<p><font size=4><strong>Fill out this form: </strong> </font></p>

<p><br>
            <label for="strEmail"><strong><strong>1.</strong> If your skill set is suitable to other committees, </label>
          </p>
          <table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td colspan="2" height="5" width="100%">
                <cfoutput><input type="radio" name="contactme" value="Yes">Yes &nbsp;
                
                <input type="radio" name="contactme" value="No">No<br></cfoutput>
                
                <p><br><label for="strEmail"><strong><strong>2.</strong> Which of the following types of committee would you prefer to serve on?</label>
          </p>
                    
          <table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td colspan="2" height="5" width="100%">
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF1" value="POL">POL          <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF2" value="SOP">SOP                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF3" value="EE">EE<br />
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF4" value="ADMIN" />ADMIN        <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF5" value="TF">TF              <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF6" value="ANY">ANY           <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF7" value="SP">SP
                </td>
            </tr>
          </table>
                   <p align="center">
            <input type="hidden" name="xaction" value="true">
            <input type="submit" value="Submit &raquo;">
            
            &nbsp;&nbsp;
            <input type="reset" value="Reset" name="B2">
          </p>
        </cfform>
</body>
</html>
MyTestFormLayout.jpg
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros