By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,813 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,813 IT Pros & Developers. It's quick & easy.

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

P: 4
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

Expand|Select|Wrap|Line Numbers
  1. <Page Title="AFMBS Q10">
  2.    <Load>
  3.        <Execute>
  4.     campaignOnLoad()
  5.        </Execute>
  6.    </Load>
  7. <Script src="q10.js"></Script>
  8.  
  9. <div id="questions">
  10. </div>    
  11.  
  12. <p id="response">
  13. </p>
  14.  
  15.  
  16. </Page>

Here is my .js page:

Expand|Select|Wrap|Line Numbers
  1. function pageOnLoad() //Set Page Specific Event Listeners and any functions you want called on load for this page.{
  2.     $S('CURRENTPAGE', 'q10')
  3.     questions().each(function(f) {
  4.     unDash(waParseInt(f.gsub(/Q/, '')))
  5.     create_html_for(f)
  6.      createScrollList({location: f+'Row', name: f, size: 1, values: getScale(f), program: programs(f), label: getText(f)})
  7.      eval(programs(f))
  8.       })
  9. }
  10. function questions() {
  11.      return getFields(10)
  12. }
  13. function text() {
  14.     return $H({
  15.          English: $H({
  16.     Q010: 'In the last 12 months, how often were the forms from Affinity easy to fill out?  Would you say…'
  17.                })
  18.       })
  19. }
  20. function scales() {
  21.       return $H({
  22.      English: $H({
  23.                   Q010: $H({'': '*READ LIST*',                                  A: 'Always',
  24.                       B: 'Usually',                                      C: 'Sometimes',                                  D: 'Never',
  25.                       E: 'It was not necessary for you to fill out any forms from Affinity',
  26.                       U: 'Unsure(DON\'T READ)'
  27.                                                 })
  28.          })
  29.         })
  30. }
  31.  
  32. function programs(question) {
  33.     var progs = 'mark_as_answered(\''+question+'\');'
  34.     progs += 'showCommentFor(\''+question.gsub(/[A-Z]$/, '')+'\', conditionsFor(\''+question.gsub(/[A-Z]$/, '')+'\'));'
  35.     return progs
  36. }
  37. function conditionsFor(question) {
  38.     var comments = $H({})
  39.     return comments.get(question) || ''
  40. }
  41. function onNextButton() {
  42.     if (validate()) {
  43.         $S('NEXT', 'q11')    
  44.         nextpage()
  45.     }
  46. }
  47. function validate() {
  48.     if (questions_to_validate().any(function(q) {return $G(q) == ''})) {
  49.         alert('You must answer all the questions.')
  50.         return false
  51.     }
  52.     if (questions_to_validate().any(function(question) {
  53.                                          if (conditionsFor(question).split(',').include($G(question)) && $G(question.comment()) == '') {
  54.                                          alert('You must enter a comment for ' + question + '.')
  55.                                     return true                                 }                             })) {
  56.         return false
  57.     }
  58.     return true
  59. }
Apr 7 '10 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
What do you currently have instead of checkboxes?
Apr 29 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.