Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to check the state of a Radio Button in Flex 3?
    primarykey
    data
    text
    <p>I'm working on a template for dynamic questionnaires in Flex. More detailed description in my previous thread <a href="https://stackoverflow.com/questions/5523081/dynamic-questionnaire-in-flex">HERE</a></p> <p>To create the questionnaire, I use nested repeaters - one for the questions and one for the answers (as their amount may vary).</p> <pre><code>&lt;mx:Repeater id="r" dataProvider="{questions}"&gt; &lt;mx:Label text="{r.currentItem.question}" width="200"/&gt; &lt;mx:Repeater id="r2" dataProvider="{r.currentItem.answers}"&gt; &lt;mx:RadioButton label="{r2.currentItem.text}" width="200" click="answerHandler(event, event.currentTarget.getRepeaterItem())"/&gt; &lt;/mx:Repeater&gt; &lt;/mx:Repeater&gt; </code></pre> <p>To understand my data providers, it's probably best to check the answer for my previous thread - easier than if I try to explain it here.</p> <p>The question here is... As you can see, I created click event handler for each radio button and my plan was to do playerScore++ every time the user chose correctly (which can be achieved by checking the Boolean property "correct" of sent RepeaterItem). </p> <p>However, I see now that even if the button is selected already, I can still click on it more times, and even though it's not changing anything in the view, it increments the score every time.. I would also have to handle situation in which the user changes his mind (I could give + points for each good answer and - points for wrong, but this would mean, that if the user chose more wrong answers, my score will be negative and I don't want it).</p> <p>So it would be way way easier to just have a Submit button and check the states of all my buttons and if they are correct only after the user clicks "submit". Is it possible?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload