views:

177

answers:

1

Hi,

I was writing a simple login form, everything works fine (validation etc.) but I can't get the values, there's my code:

public function executeIndex(sfWebRequest $request)
  {
      $this->getUser()->clearCredentials();
      $this->getUser()->setAuthenticated(false);

      $this->form = new LoginForm();

      if ($request->isMethod('post') && $request->hasParameter('login')) {
          $this->form->bind($request->getParameter('login'));

          if ($this->form->isValid()) {

              $this->getUser()->setAuthenticated(true);
              $this->getUser()->addCredential('user');
              $this->login = $this->form->getValue('login');
          }
      }
  }

$this->login is NULL. Now I checked almost everything, the form is valid, isBound() is true, count() returns 3, I can see the values in my request:

parameterHolder:
  action: index
  login: { login: foo, password: foo, _csrf_token: 53ebddee1883d7e3d6575d6fb1707a15 }
  module: login

BUT getValues() returns NULL, getValue('login') etc. returns NULL as well. How can it be?

And no, I don't want to use sfGuard-Plugins ;)

+2  A: 

What about trying something like this

$form['value_name']->getValue()

Is it still NULL?

Also is it possible that you created a custom post validator?

Serge
Cav
I was asking because it might be possible that something is wrong with your validator or that it isn't returning anything at all so you're getting a NULL value
Serge
damn, you're right, I didn't return $values... thanks again!
Cav