开发者

Silex + form validation

I'm trying to create a simple form validation with Silex. Since there is no official guide to the forms extension yet, I'm following the instructions on this site: http://dev.umpirsky.com/create-kick-ass-website-in-no-time-with-silex/

For some reason, the form won't validate correctly:

$form->isValid() // will always return true

I spent some time searching for a solution (of what seems to be a known issue), but haven't found anything useful.

Did someone else encounter this problem and knows a way around it?开发者_运维百科

Thanks!


you probably missed to register the validator extension

$app->register(new Silex\Provider\FormServiceProvider(), array(
    'form.class_path' => __DIR__ . '/../vendor/symfony/src'
));
$app->register(new Silex\Extension\ValidatorExtension(), array(
    'validator.class_path'    => __DIR__.'/vendor/symfony/src',
));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜