我在写一个简单的登录表单,一切工作正常(验证等),但我不能让价值观,还有我的code:
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'); } } }$这个 - >登录为NULL。现在,我检查了几乎所有的东西,形式是有效的,一个isBound()为真,COUNT()返回3,我可以看到我的请求,值:
$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: loginBUT的GetValues()返回NULL,的getValue('密码')等返回NULL为好。这怎么可能呢?
BUT getValues() returns NULL, getValue('login') etc. returns NULL as well. How can it be?
不,我不想用sfGuard-插件;)
And no, I don't want to use sfGuard-Plugins ;)
推荐答案关于尝试这样的事情是什么
What about trying something like this
$form['value_name']->getValue()这还算是NULL?
Is it still NULL?
也有可能是您创建了一个自定义后验证?
Also is it possible that you created a custom post validator?
更多推荐
Symfony的表单值丢失
发布评论