Welcome Guest, Not a member yet? Register   Sign In
Not sending my POST data - Extending Lang, Config
#1

[eluser]Mauricio de Abreu Antunes[/eluser]
Hi,
I'm here again.

I have some problems about my forms.
I'm using this lib for internationalization (extending MY_Config and MY_Lang):
https://github.com/daylerees/ci-lang - http://maestric.com/doc/php/codeigniter_i18n
My routes.php is:
Code:
$route['default_controller']  = 'welcome';
$route['404_override']    = '';
//Routing para noticias.
$route['noticias/:num']   = 'noticias';
/**
* Routing para idiomas
*/

//English, Portuguese and Spanish
$route['^(en|pt|es)/(.+)$']   = "$2";

I really don't know what is happening. When i submit any form, it refreshes and loads the same page and nothing happens.
I think my problems is in MY_Lang, MY_Config and routes.php, but i don't know how to act about about this case. I printed some messages for debug and i figured out my post is empty. It's not sending data anymore because my $_POST is empty.
I printed messages in core library and this line
Code:
public function run($group = '')
{
  // Do we even have any data to process?  Mm?
  if (count($_POST) == 0)
  {
   return FALSE;
  }
shows me an empty post array.
I guess my problem is in routes.php. Any idea?

This is my controller:
Code:
public function index () {
   if ($this->form_validation->run('teste') == false) {
    $this->load->view('teste_validacao');
   } else {
    echo 'Dados estão corretos.';
   }
  }

My URL is: http://localhost/percutz/pt/teste_validacao

OBS.: a good observations is: when i load any additional translation file like 'site_lang.php' ($this->lang->load('site', 'portuguese')) it does not load and shows me this error: File site.php does not exist, but the syntax is ok, because before these changing about internationalization, i was not getting this error.

pt = my language (portuguese)
Any idea?
#2

[eluser]Mauricio de Abreu Antunes[/eluser]
I'm not figuring out the problem.
A lot of debugs and nothing.
Can you help me?
*I know this problem is hard to understand.
#3

[eluser]Mauricio de Abreu Antunes[/eluser]
Come on, i did not find any result on google.
#4

[eluser]Mauricio de Abreu Antunes[/eluser]
I sent an e-mail to Jérôme and he has no time for look at my code. Sad
#5

[eluser]Mauricio de Abreu Antunes[/eluser]
71 views and no answers? :blank:
#6

[eluser]Mauricio de Abreu Antunes[/eluser]
AGAIN!
I'm using this library and i'm getting this error when i submit the form:e

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: libraries/Form_validation.php

Line Number: 320


Ok, this line shows me:

Code:
// Load the language file containing error messages
$this->CI->lang->load('form_validation');

Any idea?
#7

[eluser]Kristories[/eluser]
Try this one..
Code:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['noticias/:num'] = 'noticias';
$route['^(en|pt|es)/(.+)$'] = "$2";
$route['^(en|pt|es)$'] = 'welcome';
#8

[eluser]Mauricio de Abreu Antunes[/eluser]
My routes.php looks like this one.
It did not work.

I guess that problems is in:
Code:
$this->form_validation->run('teste') or $this->form_validation->run()

It's not finding language config files like form_validation.
#9

[eluser]Kristories[/eluser]
I can't see this code in your config
Code:
$route['^(en|pt|es)$'] = 'welcome';
Ok, forget it!
Oh, where your rules? Like this one..
Code:
$config = array(
               array(
                     'field'   => 'username',
                     'label'   => 'Username',
                     'rules'   => 'required'
                  ),
               array(
                     'field'   => 'password',
                     'label'   => 'Password',
                     'rules'   => 'required'
                  ),
               array(
                     'field'   => 'passconf',
                     'label'   => 'Password Confirmation',
                     'rules'   => 'required'
                  ),  
               array(
                     'field'   => 'email',
                     'label'   => 'Email',
                     'rules'   => 'required'
                  )
            );

$this->form_validation->set_rules($config);

Form validation not work if you forgot to set rules
#10

[eluser]Kristories[/eluser]
If you no need to validating.. Use [trim]!
Code:
$config = array(
               array(
                     'field'   => 'username',
                     'label'   => 'Username',
                     'rules'   => 'trim'
                  )
            );

$this->form_validation->set_rules($config);




Theme © iAndrew 2016 - Forum software by © MyBB