Welcome Guest, Not a member yet? Register   Sign In
Dynamic form with Form Helper + Scripting?
#1

[eluser]brucebat[/eluser]
Hey all,

I am wanting to design a dynamic form that will have a logic like this.

This is pseudo code for what needs to be implemented
Code:
Get all rows in department table.
      Display rows in pull down menu.


++When pull down item is selected -> display appropriate next part of form.

Get all rows from medical procedure table where deparment = selected deparment by the user
      Display rows in a pull down menu

++When pull down item is selected -> display appropriate next part of form.

Get all rows from medical staff table where staff belong to that department
     Display staff in pull down, with text box next to it which users can enter the quantity of staff

          if staff pull down field completed
                {
                   count = count + 1
                   Display another staff pull down menu with id="count" and text box with id="count"
                }
           else
               {
                  break
               }

++Display Events part (this is the really long and varying part of the form where the user has to enter a list of events with time , equipment used, and a comment if necessary

       for (i=0, i>15, i++)
             {
              count= count +1
              display a text field with pop out javascript time selector
                  get all rows from medical supplies and store them in a temporary array
              display a text field for user comments

             }

         when user enters a string that is similar to specific medical supplies e.g. (user enters def, the form display a list of matching strings in the stored array of medical items[defribulator, etc], display it on list that can be selected to speed the users input.


           if the user completes the last field add more events fields with count=count+1


I am using CI's form helper but I have no idea how to implement the rest does anyone have any links to documentation or sample code which would help.

I guess I will need to use scripting so if anyone knows any links for scripts that would be great too.


as well to implement it but I was wondering if CI has any features that I could use to speed up development for this form?

Thanks for your time!
#2

[eluser]adityamenon[/eluser]
http://www.9lessons.info/2010/08/dynamic...using.html

http://tinyurl.com/5ux8ego
#3

[eluser]brucebat[/eluser]
Thanks

How would I generate more textbox fields automatically when the user completes a field.

e.g.

user completes textbox id=2 ,

script generates another textbox id=3,

until user leave textbox x blank.

Sorry for my ignorance but I have never done a form like this before.

Thankyou
#4

[eluser]adityamenon[/eluser]
Actually, this a Javascript problem. Please research more about Javascript. The time investment you make now will be better than fumbling and stumbling through your form project. However, that advice is useless if you need the work finished yesterday Smile

http://tinyurl.com/3ely34j

Good luck.
#5

[eluser]brucebat[/eluser]
Okay

So basically this is what I had originally planned.

Quote:CI Form Helper + Scripting --> CI Controller Validation --> CI Model --> Database

However this what you are recommending I do.

Quote:Scriped form --$_POST--> CI Controller Validation --> CI Model --> Database


I have a few days to get a prototype together for this, but Im still on the fence about this as the form is going to be quite long and varying and I am worried that script to CI might cause problems.

Forgive me if I seem a bit reluctant to dive in as I am "REALLY" in the dark about what is the right way to go about this for me and the client.

Thanks for your time.




Theme © iAndrew 2016 - Forum software by © MyBB