Home > Uncategorized > How To Set Answers in Multiple Selection Questions

How To Set Answers in Multiple Selection Questions



This how-to will show you how to set specific answers in multiple selection questions.


Difference between SetAnswer() and dblSetSpecificAnswer()


When dealing with setting answers, there are two main functions for doing that.

1st one is SetAnswer():
This function get’s two parameters:
1st param’: Question index

2nd param’: Array of answer indexes to set


For example:

Will set answer 1 in question 3, whether it’s a single-choice question or a multiple-selection question.



Will set answer 4,6,8 in question 3 which should be a multiple selection question.


However, if the answer’s which are being set might change during run-time, if you would do this:



Intuitively you would expect answer 1,4,6,8 to be set – However, only answer 1 will be set, due to the fact that SetAnswer() function, is re-setting the answer’s to Not selected each timed it is being called.


Therefore, there is the function dblSetSpecificAnswer()

This function get’s 3 parameters:
1st param’: Question Index

2nd param’: Answer Index

3rd param’: ‘true’ for selecting, ‘false’ for un-selecting


For example:

Will set answer 4 in question 3.



Will de-select answer 4 in question 3 (if it was previously chosen).




Will select answer 7 & 6 in question 3 (Without re-setting previous selections like SetAnswer() does)


As you can see, this function is more useful when needing to modify answer selection without affecting previous selections.


That’s it!


Visit us at: http://www.dooblo.net


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: