-
vertisan
Junior Member
-
Posts: 39
Threads: 25
Joined: Feb 2015
Reputation:
0
Hi!
I have problem with Form Validation from CI 3.0 RC2.
I have method in controller:
PHP Code: public function dodaj() { // ... if ( !empty( $_POST ) ) { $this->form_validation->set_rules('imie_wolont', 'Imie wolontariusza', 'trim|required'); $this->form_validation->set_rules('d_imie_wolont', 'Drugie mie wolontariusza', 'trim|required'); //etc
if ($this->form_validation->run() == TRUE) { $dodaj_wolont = array( 'imie' => $this->input->post( 'imie_wolont' ), 'drugie_imie' => $this->input->post( 'd_imie_wolont' ), // etc );
$this->Wolontariusze_model->dodaj( 'wolontariusze' , $dodaj_wolont ); } }
and view with:
PHP Code: echo validation_errors();
but i don't getting errors, why? (I have form and form_validation in autoload)
-
RobertSF
Member
-
Posts: 239
Threads: 7
Joined: Oct 2014
Reputation:
16
Everything looks ok, but here are some ideas.
Are the set_rules statements executing? Check with an echo statement.
Does the run() statement really return TRUE? Check with an echo statement.
Try the rules with only 'required' and see if anything changes.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
-
RobertSF
Member
-
Posts: 239
Threads: 7
Joined: Oct 2014
Reputation:
16
(02-13-2015, 06:49 PM)Narf Wrote: echo TRUE; will echo nothing.
Ha, ha, ha, true! But...
PHP Code: $x = $this->form_validation->run(); echo $x;
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
-
RobertSF
Member
-
Posts: 239
Threads: 7
Joined: Oct 2014
Reputation:
16
02-14-2015, 01:56 PM
(This post was last modified: 02-14-2015, 02:03 PM by RobertSF.)
var_dump is definitely the way to go.
But just to clarify, only FALSE results in an empty string. Echoing TRUE outputs 1 to the screen.
Still, using var_dump is better than using echo, no doubt about it.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
|