简体   繁体   中英

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',
));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM