0 Replies Latest reply on Oct 26, 2010 11:22 AM by Helioborges

    Help with Comboboxes inside a repeater

    Helioborges

      Hi, I have a problem that I really need some help, if anyone knows how to do it.

       

      I have to make in flex a dynamic form that has X questions and each question can be answered 3 times by sellecting Y options in a combobox. As you can Imagine the number of questions and answers can change.

       

      Something like this:

       

       

      QUESTION                          FIRST ANSWER   2nd ANSWER      3rd ANSWER

       

      1- Which option do you like?  Combobox: A      Combobox: C        CB: A

       

      2- Second Question?             Combobox: B      Combobox: C        CB: D

       

      3- Third Question?                 Combobox: A      Combobox: Blank  CB: B

      (CB: means Combobox - I just made it shorter so it could fit the window)

       

       

      I managed to correctly using a repeater show all the questions and each combobox has all the right options inside. All I want now is to get the data from those comboboxes.

       

      This is a Simplified code (I removed all the non-essencial stuff) so you can get an idea:

       

      <mx:Repeater id="rp">

       

      <mx:VBox label="{rp.currentItem.nome}"

      width="100%">

       

      <mx:Repeater id="qt"

      dataProvider="{rp.currentItem.tbdavaliacao_pergunta}">

       

       

      <mx:HBox width="100%"

      verticalAlign="middle"

      horizontalAlign="center">

       

       

      <!-- This is the question text -->

      <mx:Text text="{String(qt.currentItem.nome)}"

      textAlign="center"/>

       

      <!-- Next, are the 3 comboboxes that are repeated X times -->

       

                                              <mx:ComboBox dataProvider="{grau}"

                                                             id="auto"

                                                             textAlign="center">

                                               </mx:ComboBox>

       

                                              <mx:ComboBox dataProvider="{grau}"

                                                             id="superior"

                                                             textAlign="center">

                                              </mx:ComboBox>

       

                                              <mx:ComboBox dataProvider="{grau}"

                                                             id="resultado"

                                                             textAlign="center">

                                              </mx:ComboBox>

       

      </mx:HBox>

       

      </mx:Repeater>

      </mx:VBox>

       

      </mx:Repeater>

       

       

       

       

      Anyone has an idea of how can I get all the answers from all my dynamic comboboxes?

       

      The perfect AND ideal solution would be having X Dynamic objects with the question id + the combobox id storing the answer sellected.

      So I would know that the question 32 has the answers A, B and A for an example.

       

       

      qt.currentitem.id + combobox.id = selectedLabel

      (question ID) + (combobox id) = (selectedLabel)

       

      32auto = 'A'

      32superior = 'B'

      32resultado = 'A'

       

      Or just one arraycollection with all the answers...

      At this point, I would accept any answer or idea or sollution...

       

       

      Thanks a lot!!