1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP Survey - Skipping Questions

Discussion in 'C#' started by mitcho, Aug 9, 2006.

  1. #1
    Hi guys, im new to ASP so please be kind.
    I have been creating an ASP survey based on an open-source survey by Guo Xu from planet source code. anyway, it is basically a multiple choice survey where users firstly enter their details, and then answer a series of multiple choice questions. You can see this here http://www.beaniekids.com/test/bkq2/user_details.asp . This survey uses an Access database which can be downloaded here: http://www.beaniekids.com/test/bkq2/survey.mdb

    My Question is, How can i skip questions....

    For example, the first question asks if a user is male or female.
    If they answer MALE i want it to skip to Question 3 instead of going to Question 2. How can this be done. i have tried a number of times but cant seem to do it...

    i have attached the text asp files for The questionnaire (which is one page that displays each question). i have also attached the proceed and tally asp text files which are called after each question is answered (if you need any more files let me know and ill post up).

    If you could show me the code to use would be greatly appreciated.
     

    Attached Files:

    mitcho, Aug 9, 2006 IP
  2. Nafai

    Nafai Peon

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Looks like you have the current question stored/passed in Request.Querystring("QC").

    Instead of putting the querystring directly on the ACTION attribute of the FORM element, make it a hidden input:

    
    <form action="proceed.asp" method="post">
    <input type="hidden" name="QC" value="<%=request.querystring("QC")%>">
    
    Code (markup):
    Then, you can use javascript so that when they click on the "Male" radio box, it changes the value of the hidden input to be QC+1 (to skip a question).
     
    Nafai, Aug 10, 2006 IP
  3. mitcho

    mitcho Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you provide an example of what the javascript code would look like.

    thank you
     
    mitcho, Aug 11, 2006 IP
  4. Nafai

    Nafai Peon

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Something like:

    
    <input type="radio" name="gender" value="male" onclick="document.form1.qc.value=3;"> Male
    <input type="radio" name="gender" value="female" onclick="document.form1.qc.value=2;"> Female
    
    Code (markup):
    Of course you'll have to put name="form1" on the form tag. To make it browser independent you'll have to use something like theDoc as a variable to reference the document object, and in the header script use some browser-independent code to create the theDoc variable. document.whatever only works in IE I think.
     
    Nafai, Aug 11, 2006 IP