Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with Survey - Using Checkboxes and JavaScript

    Hello,

    I am trying to create a survey. I have five categories and each has 6 or more questions (answers as scale 1-10) in it.

    Eg. Finance, Economy, Private Sector, Technology.

    Finance:
    Q1: blah blah blah?
    Radio Buttons: 1 - 10

    Q2: blah blah blah?
    Radio Buttons: 1 - 10

    I want the user to select the categories they want to be surveyed in by providing a check box beside each category. The user can select one or more categories.

    When the user checks the categories and click Submit or OK, on the next page, it should display only those categories that the user selected with their respective questions.

    How do I achieve this? Please help me.

    Thanks in advance.

    Newbie

    Affu Q

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You may set all the radios as disabled by default, and enable only the groups related to the check boxes. Disabled elements do not send their values onsubmit. To give you an example I must know how your elements are HTML grouped, show us one or two of your groups check-box/radios. I mean the way you want to code them HTML
    Last edited by Kor; 04-27-2006 at 04:44 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Thanks for the reply. Here is the code that I think want to use.

    I would like the user to select one or more sector, click Go and then should be able to see questions from the selected sector on th next page.

    I also need help with what I need to put in the action for the form that I am using (please see code.)

    Thanks for your help.

    Affu Q

    Code:
    <body>
    <p>&nbsp</p>
    <p>Welcome User,</p>
    
    <form name="Sector" method="POST" action="I also need help with this??">
    	<!--I need to know what to put in the action. All I want is to remember the selection from the user to display the questions on the next page-->
    	<div><span class="clsSearchSteps">1.&nbsp</span><span class="sectionHeadBlack">&nbsp;<b>Please select the sector:</b></span>
    <br><br>
    <div class="ColorBar" align="center">
    <table cellspacing="0" cellpadding="3" border="1" width="75%">
    <tr>
    <td><input type="Checkbox" name="c1" value="0"  title="Economics">Economics<br></td>
    <td><input type="Checkbox" name="c1" value="1"  title="Finance">Finance<br></td>
    <td><input type="Checkbox" name="c1" value="2"  title="Private Sector">Private Sector<br></td>
    <td><input type="Checkbox" name="c1" value="3"  title="Social">Social<br></td>
    </tr>
    </table>
    </div>
    	
    <p><input type="submit" value="Go" name="B1"></p>
    </form>




    Quote Originally Posted by Kor
    You may set all the radios as disabled by default, and enable only the groups related to the check boxes. Disabled elements do not send their values onsubmit. To give you an example I must know how your elements are HTML grouped, show us one or two of your groups check-box/radios. I mean the way you want to code them HTML

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    All I want is to remember the selection from the user to display the questions on the next page
    In this case you must use a server-side aplication, not javascript (which is a client-side).
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    If I just want to use JavaScript, how would I do it?

    Thanks

    Affu Q

  • #6
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,503
    Thanks
    3
    Thanked 500 Times in 487 Posts
    you could use a cookie

    http://www.vicsjavascripts.org.uk/Fo...Compendium.htm

    script f19
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #7
    New to the CF scene
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Hello Vic,

    Could you please give me an example with one of the categories that I specified in the code above.

    Thanks in advance

    Affu Q


    Quote Originally Posted by vwphillips

  • #8
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,503
    Thanks
    3
    Thanked 500 Times in 487 Posts
    Code:
    <body onload="f19_GetFormCookie();" >
    <form title="f19_Include"  onclick="f19_SetFormCookie();">
     <INPUT name="Q1" type="radio" >
     <INPUT name="Q1" type="radio" >
     <INPUT name="Q1" type="radio" >
     <INPUT name="Q1" type="radio" ><br>
     <INPUT name="Q2" type="radio" >
     <INPUT name="Q2" type="radio" >
     <INPUT name="Q2" type="radio" >
     <INPUT name="Q2" type="radio" >
    </form>
    Code:
    <body onload="f19_GetFormCookie();zxcFind();" >
    <div id="fred" >
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O1 A1</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O1 A2</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O1 A3</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O1 A4</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O2 A1</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O2 A2</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O2 A3</div>
    <div style="display:none;width:200px;height:50px;background-color:#FFFFCC;" >O2 A4</div>
    </div>
    
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function zxcFind(){
     var pobj=document.getElementById('fred');
     var ds=pobj.getElementsByTagName('DIV');
     var conds=f19_GetCookie(f19_Cookie+'RC').split('~^~');
     for (var zxc0=0;zxc0<ds.length;zxc0++){
      if (conds[zxc0]=='true'){
       ds[zxc0].style.display='';
      }
     }
    }
    
    //-->
    </script>
    + the f19 code on each page
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #9
    New to the CF scene
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you so much Vic. I will give this a try.

    I will let you know if I get stuck somewhere.

    Thanks again

    Affu Q


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •