CodeIgniter Forums
reload form after save - 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: reload form after save (/showthread.php?tid=14775)



reload form after save - El Forum - 01-14-2009

[eluser]al404[/eluser]
i'm a beginner, i have a problem:

i don't know the best way to reload a form after saving results (with preload data)


in moduls i have

function loadFormRecord(){
load data to fill form
}

in controller

function form(){
call module loadFormRecord()

code to generete form that i pass
to form viewer
}


now i need to save and display again the form

i will make a new save function in my controller
can i recall form() function into save?

would it be more correct to build my form in a new module function?


reload form after save - El Forum - 01-14-2009

[eluser]Colin Williams[/eluser]
Looks like you haven't gotten very far. I would say go with your gut and see where and how far it takes you.


reload form after save - El Forum - 01-14-2009

[eluser]al404[/eluser]
sorry but i can't really understand wich is the cleaner way to do this

from what i read here
http://ellislab.com/forums/viewthread/47642/

it seem that it is not possible to pass data from controller to model

so if i have a model that load data i can't then pass them to an other model to create the form (populated with values)


reload form after save - El Forum - 01-14-2009

[eluser]Colin Williams[/eluser]
Watching these http://ellislab.com/forums/viewthread/92009/ might help.

And you can pass data to any method in PHP with arguments. The only limitation with CI and models is that you can't pass arguments to the model constructor. This can be remedied by having an initialize() method in the model that must be called directly.


reload form after save - El Forum - 01-15-2009

[eluser]al404[/eluser]
thanks thats helps me a lot!