Welcome Guest, Not a member yet? Register   Sign In
CI Form-Framework 1.0.1 - a form abstraction layer
#11

[eluser]benboi[/eluser]
Hello,

what is your imagination? For me having multipage-forms is like having the input of steps passed before inside of the session and when the user hits the back button, the form is repopulatet, with the data found in session.

Is that you imagination? Wink

Sure, i could give it a try, but ill need to buildin a mechanism, that data is not overwritten, because of the same fieldnames (maybe using an internal descriptor, generated from the class-name + '_fieldname')

I have to think about this, but definitly a good idea Wink

Greets
#12

[eluser]codeninja[/eluser]
Check out http://hg.mijnpraktijk.com/ab_wizard/wiki/Home for ideas..
#13

[eluser]codeninja[/eluser]
How do we handle custom validation functions?
#14

[eluser]benboi[/eluser]
Hello,


didn't test it yet, i think defining it as public function in your current form-class should do it. Will take a look on that.

Thanks for your question Wink
#15

[eluser]benboi[/eluser]
Added custom Loader class, for the use with hmvc.

Form classes now have to be located in the current module/forms path. To use it, just let the MY_Loader.php extend the Form_Loader.php. This class is already extending MX_Loader Wink

Have fun ...
#16

[eluser]benboi[/eluser]
updated ... see first post.
#17

[eluser]benboi[/eluser]
Someone asked me to provide a quick example on how to use the new "save to session"-feature.

Here is a easy one. Imagine you have 2 different form-classes created and they both have some fields which have the same names.

Have a look in our controller:

Code:
class Order_process extends CI_Controller {

public function step1() {
   $this->load->form('step1_form');

   if($this->input->post('submit')) {

       if($this->step1_form->is_valid()) {

           /* save values to session */
           $this->step1_form->save_to_session();
           /* redirect to next step */
           redirect('order_process/step2');


       }

   } else {

     if($this->step1_form->has_session_data()) {

        /* if session data for this form is found and this action wasnt called using post, refill the fields with the data from session */
        $this->step1_form->load_from_session();

     }

     echo $this->step1_form;


   }

}

public function step2() {
   $this->load->form('step2_form');

   if($this->input->post('submit')) {

       if($this->step2_form->is_valid()) {

           /* save values to session */
           $this->step2_form->save_to_session();
           /* redirect to overview */
           redirect('order_process/overview');


       }

   } else {

     if($this->step2_form->has_session_data()) {
        /* if session data for this form is found and this action wasnt called using post, refill the fields with the data from session */
        $this->step2_form->load_from_session();

     }

     echo $this->step2_form;


   }

}

public function overview() {


   $this->load->form('step1_form');
   $this->load->form('step2_form');

   /* load the values of both forms */
   $form1 = $this->step1_form->get_from_session();
   $form2 = $this->step2_form->get_from_session();

}

}

Thats it Wink

Please note, that having many forms in session requires you to enable db-based sessions.
#18

[eluser]Unknown[/eluser]
Hi there,

I'm currently using this framework, and I'm wondering if it's possible to set custom validation error messagess for each element?

Cheers,
Mark P.




Theme © iAndrew 2016 - Forum software by © MyBB