I want to be able to select multiple options for a question.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • love91501
    New Member
    • Apr 2010
    • 4

    #1

    I want to be able to select multiple options for a question.

    I was wondering if anyone would be able to help me figure out how to make my Q010 have the ability to chose 2 answers, I'm hoping to stay away from checkboxes but I am willing to take in any advice. If you need more information just let me know. Thanks!



    Here is my .was page

    Code:
    <Page Title="AFMBS Q10">
       <Load>
           <Execute>
    	campaignOnLoad()
           </Execute>
       </Load>
    <Script src="q10.js"></Script>
    
    <div id="questions">
    </div>	
    	
    <p id="response">
    </p>
    	
    					
    </Page>

    Here is my .js page:

    Code:
    function pageOnLoad() //Set Page Specific Event Listeners and any functions you want called on load for this page.{
        $S('CURRENTPAGE', 'q10')
        questions().each(function(f) {
        unDash(waParseInt(f.gsub(/Q/, '')))
        create_html_for(f)
         createScrollList({location: f+'Row', name: f, size: 1, values: getScale(f), program: programs(f), label: getText(f)})
         eval(programs(f))
          })
    }
    function questions() {
         return getFields(10)
    }
    function text() {
        return $H({
             English: $H({
    	Q010: 'In the last 12 months, how often were the forms from Affinity easy to fill out?  Would you say…'
    	           })
    	  })
    }
    function scales() {
          return $H({
    	 English: $H({
    	              Q010: $H({'': '*READ LIST*',					              A: 'Always',
    		              B: 'Usually',						              C: 'Sometimes',					              D: 'Never',
    		              E: 'It was not necessary for you to fill out any forms from Affinity',
    		              U: 'Unsure(DON\'T READ)'
    									            })
    		 })
    	    })
    }
    
    function programs(question) {
    	var progs = 'mark_as_answered(\''+question+'\');'
    	progs += 'showCommentFor(\''+question.gsub(/[A-Z]$/, '')+'\', conditionsFor(\''+question.gsub(/[A-Z]$/, '')+'\'));'
    	return progs
    }
    function conditionsFor(question) {
    	var comments = $H({})
    	return comments.get(question) || ''
    }
    function onNextButton() {
    	if (validate()) {
    		$S('NEXT', 'q11')	
    		nextpage()
    	}
    }
    function validate() {
    	if (questions_to_validate().any(function(q) {return $G(q) == ''})) {
    		alert('You must answer all the questions.')
    		return false
    	}
    	if (questions_to_validate().any(function(question) {
    								         if (conditionsFor(question).split(',').include($G(question)) && $G(question.comment()) == '') {
    								         alert('You must enter a comment for ' + question + '.')
    									return true								 }							 })) {
    		return false
    	}
    	return true
    }
    Last edited by gits; Apr 7 '10, 05:34 PM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    What do you currently have instead of checkboxes?

    Comment

    Working...