CodeIgniter Forums
Pagination with Form Fields - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Pagination with Form Fields (/showthread.php?tid=62251)



Pagination with Form Fields - kbshaik1437 - 06-24-2015

Hi,

I have a questionnaire and I am using pagination to display the questions with Yes / No radio options.

When user selects Yes I am enabling a TextArea to enter the Answer. But when I am navigating to different pages, the entered data is not staying.

Please suggest.

Thanks
Khasim


RE: Pagination with Form Fields - Dracula - 06-24-2015

You can use sessions


RE: Pagination with Form Fields - Wouter60 - 06-24-2015

This isn't really a CI question. It is due to the way html forms work.
If you fill in a form and you go to another page without submitting the form, nothing happens with the information that has been filled in.

So, before you move to another page, you have to submit the form and either store the data into the database, or into the session for later use.

Another approach is to put all questions in one big form, and use Javascript (or Jquery) to initially hide and later on show the fields that can be filled in. Jquery UI provides a "tabs" function that can be used to achieve this effect.
Say, your questionnaire has 10 steps, then your form is divided over 10 tabs (which are essentially divs inside a div that is marked as the tabs container). Initially, tab 1 is visible; the other tabs are hidden. When you move to the next question, tab 2 is shown, and the other tabs are hidden, etc. It has an option to hide tab headings, so the user doesn't see the tabs at all.