CodeIgniter Forums
validation problem with multi-page form: radio buttons seem to inherit previous selection state - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: validation problem with multi-page form: radio buttons seem to inherit previous selection state (/showthread.php?tid=2136)



validation problem with multi-page form: radio buttons seem to inherit previous selection state - El Forum - 07-18-2007

[eluser]moonbeetle[/eluser]
Hi I want to build a multi-page survey with CI. Let's say I want to show 32 questions and offer them on 4 sequential pages each time showing 8 multiple-choice questions (2 answers to choose from per question by selecting a radio button) per page. At the and of the page a submit button is used to go to the next page until the end (page count) is reached.

Like this: page1 -> page2 ->page3 -> page4

Validation is crucial as I want the user to answer to each question.

I update the page count as well as the offset (for fetching the question from a database). I do this in case $this->validation->run() is TRUE. Then I load the view again, passing the updated values and next batch of questions. In case the validation returns FALSE, meaning one or more questions haven't been answered, I show the page again and use $this->validation->set_radio() to set the selected state for the questions that have been answered.

The problem:
the multiple-choice selection from a previous page gets passed to the next page. Why is this or how can I reset this without losing the benefit of usability?


validation problem with multi-page form: radio buttons seem to inherit previous selection state - El Forum - 07-18-2007

[eluser]moonbeetle[/eluser]
Solved by using $this->validation->set_radio() conditionally on the view


validation problem with multi-page form: radio buttons seem to inherit previous selection state - El Forum - 06-06-2011

[eluser]xorcistforyou[/eluser]
i am trying to do multi choice survey system. Each test has 20 questions..

i finished admin panel for this. i am using unlimited cat list, adding question under this cats and update - delete - new quest... i am planning ffront-end now.

how do you compare right and wrong answers when the form submitted.

Can you give me some code for this or some advice the solve this..


validation problem with multi-page form: radio buttons seem to inherit previous selection state - El Forum - 06-10-2011

[eluser]Brad K Morse[/eluser]
@xorclstforyou - what qualifies as a wrong answer for your survey?


validation problem with multi-page form: radio buttons seem to inherit previous selection state - El Forum - 06-26-2011

[eluser]xorcistforyou[/eluser]
[quote author="bkmorse" date="1307739033"]@xorclstforyou - what qualifies as a wrong answer for your survey?[/quote]

i did something like this.

1. in table, i create two fields as called "scevap" and "dcevap".
2. added choices to scevap field like this "a|b|c|d|e". than separate them this "|" char by explode.
3. put the true and wrong answers separate flat array.
4. compare two arrays. than get true and wrong answers as i want..

Soon i will add my website the survey system. Now i added questions at local.

my website is http://www.ilketkinlik.com

later i want to try multi page survey system. Ex: if i have 20 questions in test. i want to show them one by one each page. Also how can i carry data end of the test.