• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Problem] Form helper in Codeigniter v3.0rc

#1
Hi have anyone use Form Helper in Codeigniter v3.0rc.
I have a problem about it.
When My Controller receive $_POST data,
PHP Code:
$this->form_validation->run() 
always return false ...
What's happen? I set rules correctly.
And
PHP Code:
echo validation_errors(); 
no render any message ...
Who can help me.
Reply

#2
Yes, I have the same problem after a lot of tests.

If all the input fields are empty :

[Image: an3b.png]

It's okay, all the errors are found

And if I fill all fields :

[Image: fr2w.png]

The message error is that it nof found the error message, but this message exists in english and in french language.

I've also an error with the csrf security, when i activate it in the config file. it's impossible to submit a form :/
Reply

#3
Did you have 'xss_clean' included in your validation rules? Read the upgrade instructions.
Reply

#4
Yes, I've tried to deactivate it and it was the same result :/

In fact we need to deactivate global_xss_filtering in the config file and load the security helper to applicate it in the form validation rules ?

I've tried it and apparently it works.

But, when I use the csrf protection (in config file) I have this error when I try to submit a form :

The action you have requested is not allowed.

PS : Sorry for my bad english :/
Reply

#5
(01-30-2015, 08:45 AM)SquallX Wrote: Yes, I've tried to deactivate it and it was the same result :/

In fact we need to deactivate global_xss_filtering  in the config file and load the security helper to applicate it in the form validation rules ?

I've tried it and apparently it works.

If I were you, I'd remove the 'xss_rule', not try to make it work again. It is very much intentional that it's no longer a form validation rule by default.

(01-30-2015, 08:45 AM)SquallX Wrote: But, when I use the csrf protection (in config file) I have this error when I try to submit a form :

The action you have requested is not allowed.

PS : Sorry for my bad english :/

Please read the manual about CSRF protection: http://www.codeigniter.com/userguide3/li...rgery-csrf
Reply

#6
Thanks but I've already read the documentation about the csrf protection. My code is like that (I use Twig template) :

PHP Code:
         $this->data array_merge($this->data, [
 
               'page_title'    =>  'Rejoindre la communauté',
 
               'set_login'     =>  set_value('u_login'),
 
               'set_email'     =>  set_value('u_email'),
 
               'set_password'  =>  set_value('u_password'),
 
               'set_pass_conf' =>  set_value('pass_conf'),
 
               'csrf_name'     =>  $this->security->get_csrf_token_name(),
 
               'csrf_hash'     =>  $this->security->get_csrf_hash(),
 
           ]);

 
           $this->twig->display('site/user_register.twig'$this->data); 

And my users_panel.twig contains between form tags :

Code:
<div class=" col-sm-offset-2 col-sm-10">
                           <input type="hidden" name="{{ csrf_name }}" value="{{ csrf_hash }}" />
                           <button type="submit" name="submit_new" class="btn btn-primary">S'inscrire<i class="icon-after fa fa-chevron-right" style="color:#FFF"></i></button>
                       </div>

So I don't understant why the access is already refused :/
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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