﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 5  » Reading number of correct responses in surveypage within the script?</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sun, 05 Apr 2026 19:21:06 GMT</lastBuildDate><ttl>20</ttl><item><title>Reading number of correct responses in surveypage within the script?</title><link>https://forums.millisecond.com/Topic25106.aspx</link><description>Hi all,&lt;br/&gt;&lt;br/&gt;I just came across an issue in a script I'm working on that would be most elegantly solved by reading how many radiobutton questions were responded to correctly within a surveypage in order to calculate a reward for participants. For example, on the following surveypage, participants are supposed to get £0.05 per correct radiobutton response:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/CorrectAdvancedContentQuestions&amp;nbsp; = ""&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage AttentionQuestions1&amp;gt;&lt;br/&gt;/ questions = [1-3 = noreplace(BurntCity1, BurntCity2, BurntCity3)]&lt;br/&gt;/ showpagenumbers = false&lt;br/&gt;/ showquestionnumbers = false&lt;br/&gt;/ nextbuttonposition = (50%,90%)&lt;br/&gt;/ ontrialend = [values.CorrectAdvancedContentQuestions += surveypage.AttentionQuestions1.correctcount]&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ correctresponse = ("Its river's waters caused crops and animals to grow well")&lt;br/&gt;/ validresponse = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity2&amp;gt;&lt;br/&gt;/ caption = "Why did Kish summon the fire spirit?"&lt;br/&gt;/ options = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ correctresponse = ("She was angry because the people did not honor her any longer")&lt;br/&gt;/ validresponse = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity3&amp;gt;&lt;br/&gt;/ caption = "What happened to the people of the city in the end?"&lt;br/&gt;/ options = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ correctresponse = ("Many of them were burned to death and the rest were maimed")&lt;br/&gt;/ validresponse = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;My /ontrialend is an attempt to set that up (I would do the actual reward calculation in an expression later on, so I can set the reward dynamically for future task versions), but it seems as though all the attributes for the surveypage element that I could use (correct, totalcorrect, correctcount) apply to the page in its entirety (i.e. =0 if any question on the page is wrong, =1 if all questions are correct). The radiobuttons element doesn't have a correct attribute for me to reference. Is there any way to do this?&lt;br/&gt;&lt;br/&gt;My current workaround is to use conditional logic based on the answers to each individual question, à la:&lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "Its river's waters caused crops and animals to grow well") values.CorrectAdvancedContentQuestions += 1&lt;br/&gt;&lt;br/&gt;, but this seems very clunky for multiple survey pages with different questions.&lt;br/&gt;</description><pubDate>Tue, 19 Jun 2018 08:54:20 GMT</pubDate><dc:creator>AKrishna</dc:creator></item><item><title>RE: Reading number of correct responses in surveypage within the script?</title><link>https://forums.millisecond.com/Topic25122.aspx</link><description>&lt;div data-id="25119" class="if-quote-wrapper" unselectable="on" data-guid="1529423575293"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25119" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25119" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25119" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;AKrishna - Tuesday, June 19, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25119"&gt;&lt;div class="if-quote-message-margin"&gt;&lt;div data-id="25108" class="if-quote-wrapper" unselectable="on" data-guid="1529423575293"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25108" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25108" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25108" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - Monday, June 18, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25108"&gt;&lt;div class="if-quote-message-margin"&gt;&lt;div data-id="25106" class="if-quote-wrapper" unselectable="on" data-guid="1529423575293"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25106" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25106" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25106" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;AKrishna - Monday, June 18, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25106"&gt;&lt;div class="if-quote-message-margin"&gt;Hi all,&lt;br/&gt;&lt;br/&gt;I just came across an issue in a script I'm working on that would be most elegantly solved by reading how many radiobutton questions were responded to correctly within a surveypage in order to calculate a reward for participants. For example, on the following surveypage, participants are supposed to get £0.05 per correct radiobutton response:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/CorrectAdvancedContentQuestions&amp;nbsp; = ""&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage AttentionQuestions1&amp;gt;&lt;br/&gt;/ questions = [1-3 = noreplace(BurntCity1, BurntCity2, BurntCity3)]&lt;br/&gt;/ showpagenumbers = false&lt;br/&gt;/ showquestionnumbers = false&lt;br/&gt;/ nextbuttonposition = (50%,90%)&lt;br/&gt;/ ontrialend = [values.CorrectAdvancedContentQuestions += surveypage.AttentionQuestions1.correctcount]&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ correctresponse = ("Its river's waters caused crops and animals to grow well")&lt;br/&gt;/ validresponse = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity2&amp;gt;&lt;br/&gt;/ caption = "Why did Kish summon the fire spirit?"&lt;br/&gt;/ options = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ correctresponse = ("She was angry because the people did not honor her any longer")&lt;br/&gt;/ validresponse = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity3&amp;gt;&lt;br/&gt;/ caption = "What happened to the people of the city in the end?"&lt;br/&gt;/ options = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ correctresponse = ("Many of them were burned to death and the rest were maimed")&lt;br/&gt;/ validresponse = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;My /ontrialend is an attempt to set that up (I would do the actual reward calculation in an expression later on, so I can set the reward dynamically for future task versions), but it seems as though all the attributes for the surveypage element that I could use (correct, totalcorrect, correctcount) apply to the page in its entirety (i.e. =0 if any question on the page is wrong, =1 if all questions are correct). The radiobuttons element doesn't have a correct attribute for me to reference. Is there any way to do this?&lt;br/&gt;&lt;br/&gt;My current workaround is to use conditional logic based on the answers to each individual question, à la:&lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "Its river's waters caused crops and animals to grow well") values.CorrectAdvancedContentQuestions += 1&lt;br/&gt;&lt;br/&gt;, but this seems very clunky for multiple survey pages with different questions.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25106"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;The only way I can think of is to define /optionvalues in all your &amp;lt;radiobuttons&amp;gt; elements like so&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", &lt;br/&gt;"Its inhabitants were highly skilled traders", &lt;br/&gt;"Kish had blessed the city with gold and jewels", &lt;br/&gt;"Its inhabitants robbed travelers")&lt;br/&gt;/ optionvalues = ("1", "2", "3", "4")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;and then simply use conditional logic as before, which then simplifies to &lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "1") values.CorrectAdvancedContentQuestions += 1 ...&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25108"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;Hm. Still a little clunky, but perfectly serviceable, certainly if there's no way to access radiobuttons.correct - that's just my inner OCD amateur programmer complaining! ;) &lt;br/&gt;&lt;br/&gt;Thanks for your input, Dave. &lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25119"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;That is true -- &amp;lt;radiobuttons&amp;gt; do not have a correct property, i.e. there is nothing that could be accessed.&lt;br/&gt;</description><pubDate>Tue, 19 Jun 2018 08:54:20 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Reading number of correct responses in surveypage within the script?</title><link>https://forums.millisecond.com/Topic25119.aspx</link><description>&lt;div data-id="25108" class="if-quote-wrapper" unselectable="on" data-guid="1529393543453"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25108" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25108" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25108" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - Monday, June 18, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25108"&gt;&lt;div class="if-quote-message-margin"&gt;&lt;div data-id="25106" class="if-quote-wrapper" unselectable="on" data-guid="1529393543453"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25106" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25106" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25106" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;AKrishna - Monday, June 18, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25106"&gt;&lt;div class="if-quote-message-margin"&gt;Hi all,&lt;br/&gt;&lt;br/&gt;I just came across an issue in a script I'm working on that would be most elegantly solved by reading how many radiobutton questions were responded to correctly within a surveypage in order to calculate a reward for participants. For example, on the following surveypage, participants are supposed to get £0.05 per correct radiobutton response:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/CorrectAdvancedContentQuestions&amp;nbsp; = ""&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage AttentionQuestions1&amp;gt;&lt;br/&gt;/ questions = [1-3 = noreplace(BurntCity1, BurntCity2, BurntCity3)]&lt;br/&gt;/ showpagenumbers = false&lt;br/&gt;/ showquestionnumbers = false&lt;br/&gt;/ nextbuttonposition = (50%,90%)&lt;br/&gt;/ ontrialend = [values.CorrectAdvancedContentQuestions += surveypage.AttentionQuestions1.correctcount]&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ correctresponse = ("Its river's waters caused crops and animals to grow well")&lt;br/&gt;/ validresponse = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity2&amp;gt;&lt;br/&gt;/ caption = "Why did Kish summon the fire spirit?"&lt;br/&gt;/ options = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ correctresponse = ("She was angry because the people did not honor her any longer")&lt;br/&gt;/ validresponse = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity3&amp;gt;&lt;br/&gt;/ caption = "What happened to the people of the city in the end?"&lt;br/&gt;/ options = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ correctresponse = ("Many of them were burned to death and the rest were maimed")&lt;br/&gt;/ validresponse = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;My /ontrialend is an attempt to set that up (I would do the actual reward calculation in an expression later on, so I can set the reward dynamically for future task versions), but it seems as though all the attributes for the surveypage element that I could use (correct, totalcorrect, correctcount) apply to the page in its entirety (i.e. =0 if any question on the page is wrong, =1 if all questions are correct). The radiobuttons element doesn't have a correct attribute for me to reference. Is there any way to do this?&lt;br/&gt;&lt;br/&gt;My current workaround is to use conditional logic based on the answers to each individual question, à la:&lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "Its river's waters caused crops and animals to grow well") values.CorrectAdvancedContentQuestions += 1&lt;br/&gt;&lt;br/&gt;, but this seems very clunky for multiple survey pages with different questions.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25106"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;The only way I can think of is to define /optionvalues in all your &amp;lt;radiobuttons&amp;gt; elements like so&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", &lt;br/&gt;"Its inhabitants were highly skilled traders", &lt;br/&gt;"Kish had blessed the city with gold and jewels", &lt;br/&gt;"Its inhabitants robbed travelers")&lt;br/&gt;/ optionvalues = ("1", "2", "3", "4")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;and then simply use conditional logic as before, which then simplifies to &lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "1") values.CorrectAdvancedContentQuestions += 1 ...&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25108"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;Hm. Still a little clunky, but perfectly serviceable, certainly if there's no way to access radiobuttons.correct - that's just my inner OCD amateur programmer complaining! ;) &lt;br/&gt;&lt;br/&gt;Thanks for your input, Dave. &lt;br/&gt;</description><pubDate>Tue, 19 Jun 2018 00:34:12 GMT</pubDate><dc:creator>AKrishna</dc:creator></item><item><title>RE: Reading number of correct responses in surveypage within the script?</title><link>https://forums.millisecond.com/Topic25108.aspx</link><description>&lt;div data-id="25106" class="if-quote-wrapper" unselectable="on" data-guid="1529335158542"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="25106" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="25106" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="25106" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;AKrishna - Monday, June 18, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-25106"&gt;&lt;div class="if-quote-message-margin"&gt;Hi all,&lt;br/&gt;&lt;br/&gt;I just came across an issue in a script I'm working on that would be most elegantly solved by reading how many radiobutton questions were responded to correctly within a surveypage in order to calculate a reward for participants. For example, on the following surveypage, participants are supposed to get £0.05 per correct radiobutton response:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/CorrectAdvancedContentQuestions&amp;nbsp; = ""&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage AttentionQuestions1&amp;gt;&lt;br/&gt;/ questions = [1-3 = noreplace(BurntCity1, BurntCity2, BurntCity3)]&lt;br/&gt;/ showpagenumbers = false&lt;br/&gt;/ showquestionnumbers = false&lt;br/&gt;/ nextbuttonposition = (50%,90%)&lt;br/&gt;/ ontrialend = [values.CorrectAdvancedContentQuestions += surveypage.AttentionQuestions1.correctcount]&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ correctresponse = ("Its river's waters caused crops and animals to grow well")&lt;br/&gt;/ validresponse = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity2&amp;gt;&lt;br/&gt;/ caption = "Why did Kish summon the fire spirit?"&lt;br/&gt;/ options = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ correctresponse = ("She was angry because the people did not honor her any longer")&lt;br/&gt;/ validresponse = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity3&amp;gt;&lt;br/&gt;/ caption = "What happened to the people of the city in the end?"&lt;br/&gt;/ options = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ correctresponse = ("Many of them were burned to death and the rest were maimed")&lt;br/&gt;/ validresponse = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;My /ontrialend is an attempt to set that up (I would do the actual reward calculation in an expression later on, so I can set the reward dynamically for future task versions), but it seems as though all the attributes for the surveypage element that I could use (correct, totalcorrect, correctcount) apply to the page in its entirety (i.e. =0 if any question on the page is wrong, =1 if all questions are correct). The radiobuttons element doesn't have a correct attribute for me to reference. Is there any way to do this?&lt;br/&gt;&lt;br/&gt;My current workaround is to use conditional logic based on the answers to each individual question, à la:&lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "Its river's waters caused crops and animals to grow well") values.CorrectAdvancedContentQuestions += 1&lt;br/&gt;&lt;br/&gt;, but this seems very clunky for multiple survey pages with different questions.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="25106"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;The only way I can think of is to define /optionvalues in all your &amp;lt;radiobuttons&amp;gt; elements like so&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons BurntCity1&amp;gt;&lt;br/&gt;/ caption = "What was the cause of the city's initial prosperity?"&lt;br/&gt;/ options = ("Its river's waters caused crops and animals to grow well", &lt;br/&gt;"Its inhabitants were highly skilled traders", &lt;br/&gt;"Kish had blessed the city with gold and jewels", &lt;br/&gt;"Its inhabitants robbed travelers")&lt;br/&gt;/ optionvalues = ("1", "2", "3", "4")&lt;br/&gt;/ order = random&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;and then simply use conditional logic as before, which then simplifies to &lt;br/&gt;&lt;br/&gt;if (radiobuttons.BurntCity1.response == "1") values.CorrectAdvancedContentQuestions += 1 ...&lt;br/&gt;</description><pubDate>Mon, 18 Jun 2018 08:25:11 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>