| User | Post |
|
7:16 May 27, 2008
| Ali
Guest
| | | |
|
| |
|
|
I have a questions with type MULTI_TEXTBOX and several answers for each
question. I need to write a script that will calculate some averages etc.
from these answers when the user moves to a new page. I cannot find a way
to perform this using the scripting control API. Functions like
sgapiGetValue(%%ident) would appear to be the kind of thing I would need,
but they do not appear to return the values of the answers I am looking for.
My question is this - using the scripting control how do I get the value of
a textbox which is one of the answers to my question?
Cheers,
Ali.
|
|
|
1:30 May 28, 2008
| Chad
Moderator
| | | |
|
| posts 739 |
|
|
Hi Ali,
sgapiGetValue() is the correct function to use. The issue here is a Multi-Text will return more than one value. In this case an associative array with the keys being O0, O1,O2 etc. (that’s an O as in orange)for each textbox in the Multi-Text.
You can loop through the array using a foreach loop.
ex. foreach(%%array as %%item)
{
%%output .= %%item .”<br />“;
}
Hope this helps,
Chad
|
|
|
6:37 June 2, 2008
| Ali
Guest
| | | |
|
| |
|
|
Thanks for that Chad. It worked.
I was wondering if you could help me with a similar problem.
I have a matrix containing several questions and radio buttons for the
response. Using the scripting control, how can I get the values of the
responses for each question. I have tried sgapiGetScore and
sgapiGetQuestionOptionSelected, but the return is empty in both cases.
Ali.
|
|
|
10:51 June 4, 2008
| Chad
Moderator
| | | |
|
| posts 739 |
|
|
Hi Ali,
The function you need to use is sgapiGetValue(). The trick is finding the ident (question sku) for each row.
Let’s back up. Every question in a survey has a unique identifier called the ident or question sku. It can be found by Advanced Editing a question and looking in the upper right.
A table is a special question type that acts like a container for questions. Essentially each row in a table is a question, thus each row has its own ident. To find the ident for a table row, Advanced Edit the table question then go down to the Row Headings section and hover over a row title.
A Custom Matrix on the other hand is a whole different animal and we’ll discuss that later if you need to.
Once you have the ident for the table row just use sgapiGetValue(5) where 5 is the ident for the row to get that row’s value. Of course you will need to do this for every row in the table. You can use a loop of some kind to make this process easier.
Hope this helps,
Chad
|
|
|
10:19 June 9, 2008
| Ali
Guest
| | | |
|
| |
|
|
Hi Chad,
Thanks again. I am in the process of implementing your advice.
On another note, I have incorporated the hovermouse option on some of my question titles which seems to work fine. However, I have just noticed that when I preview my survey this option doesn’t work. In fact nothing appears when the mouse hovers over a question. Is there a reason for this?
|
|
|
6:53 June 9, 2008
| Chad
Moderator
| | | |
|
| posts 739 |
|
|
Hi Ali,
You have to also include the wz_tooltip.js file in the Template HTML. If you go to Look & Feel->This Theme’s HTML Template at the bottom add in the line of code:
<script type=”text/javascript” src=”http://app.sgizmo.com/surveybuilder/j/wz_tooltip.js”>
Hope this helps,
Chad
|
|
|
11:08 August 27, 2008
| Ali
Guest
| | | |
|
| |
|
|
Hi Chad,
As advised I tried inserting the lines: <script type=”text/javascript” src=”http://app.sgizmo.com/surveybuilder/j/wz_tooltip.js”> to the bottom of the theme’s HTML Template. Not only did this not work but it also stopped my survey script that I had written from working. Is there any other way of making this work?
Also, I have noticed that the unique identifier is no longer displayed on the right upper hand side of questions. Is there a reason for this?
|
|
|
7:24 August 27, 2008
| Mario
Moderator
| | Boulder, CO | |
|
| posts 555 |
|
|
Regarding the indentifier, we did the redesign and accidently removed that. We fully intend to put that back in. Regarding the former question, I'll have to relegate that to Chad tomorrow to look over, it's quite possible the answer may differ.
|
|
|
11:48 August 28, 2008
| Chad
Moderator
| | | |
|
| posts 739 |
|
|
Hi Ali,
I added the code to your “Quality Evaluation of Service-Oriented Software” Survey and it seems to work fine.
Remember if you are copying and pasting from my Forum post you NEED to replace all the double quotes (”), our Forum replaces them with 'Magic' Quotes that curve toward the text. HTML however does not understand these quotes and will break on you.
Hope this helps,
Chad
|
|