Associating a Controller Function with a Rule Group Doesn't Work With Parameter

#1
[eluser]tommo.wilson[/eluser]
In the form validation guide there is a topic on Associating a Controller Function with a Rule Group

This works perfectly when the function doesn't have a parameter. But once you introduce the parameter it stops working.

ie: This url http://www.example.com/newpage/index calls the newpage controller and index function. The form validation rules (in the config/form_validation.php file) for this are below.

Code:
'newpage/index' => array(
                                    array(
                                            'field' => 'title',
                                            'label' => 'title',
                                            'rules' => 'trim|required|alpha_numeric_space|callback_title_exists|max_length[50]'
                                         ),
                                    array(
                                            'field' => 'content',
                                            'label' => 'content',
                                            'rules' => 'trim'
                                         ) ..... etc.

This url http://www.example.com/editpage/index/30 calls the editpage controller and index function with a parameter of 30. The form validation rules (in the config/form_validation.php file) for this are below.

Code:
'editpage/index' => array(
                                    array(
                                            'field' => 'title',
                                            'label' => 'title',
                                            'rules' => 'trim|required|alpha_numeric_space|callback_title_exists|max_length[50]'
                                         ),
                                    array(
                                            'field' => 'content',
                                            'label' => 'content',
                                            'rules' => 'trim'
                                         ) ..... etc.

This second case doesn't work. I assume it is because editpage/index doesn't match up with editpage/index/30.

Does anyone know what the problem is?

Cheers
Tom

#2
[eluser]Cristian Gilè[/eluser]
Hi Tom,

http://ellislab.com/forums/viewthread/104425/

Cristian Gilè

#3
[eluser]tommo.wilson[/eluser]
Thanks dude...

That change hasn't been incorporated into the code yet but I've just copied it into mine.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.