So I’m a newbie to Yii, as I’ve mentioned in previous posts. Here’s my pickle, I’m using 3 seperate radiobuttonlists on a form. They are NOT active radiobuttonlists. The form represents a model obviously, this model is called vote. None of the fields on this form map to vote model attributes. On the form there are questions and 3 possible answers for each question. the text for these questions and answers is pulled from an xml file. Each answer is displayed with a radio button, and each answer needs to have a weight attached to it. I’ve used hidden fields which pull integer values from the same xml file. So the form is laid out roughly like this
Question1: is this a good product? // question 1 of 3
radiobutton1: I think so
weight:10 // weights are hidden fields, integer value pulled from xml file.
radiobutton2: not really
weight:7
radiobutton3: it’s ok
weight:4
Question2: Would you use it again? // question 2 of 3
radiobutton1: yes
weight:10 // weights are hidden fields, integer value pulled from xml file.
radiobutton2:no
weight:7
radiobutton3: maybe
weight:4
Question3: Why? // question 3 of 3
radiobutton1: didn’t do its job
weight:10 // weights are hidden fields, integer value pulled from xml file.
radiobutton2: I like this other product
weight:7
radiobutton3: I’d rather be fishing
weight:4
so what I need to do is, when the submit button is clicked I need to determine which radio buttons were selected on the 3 different radiobuttonlists. If, say the user selected answer 1 for all 3 questions, I need to add up the weights of those hidden fields associated with those answers and calculate a total. This info will then be used to create a certain type of vote, if that makes sense. Bare in mind the hidden fields and radiobuttons are not linked in anyway, I’d have to do that logic myself obviously. I hope this makes sense. if anyone can help I’d be eternally grateful.
Thanks in advance