Code snippets for symfony 1.x

Navigation

Snippets by user jarecky

Disable fillin filter after validation success

When using fillin filter, after validation success (all form fields are ok) if you want display page without form, fillin filter is still enabled and throws exception "Exception - No form found in this page". Use this snippet to prevent it.

in sfFillInFormFilter.class.php file

  public function execute($filterChain)
  {
    // execute next filter
    $filterChain->execute();
 
    $context  = $this->getContext();
    $response = $context->getResponse();
    $request  = $context->getRequest();
 
    // add these two lines
    if(! $request->hasErrors())
        return;
 
by jarecky on 2007-11-20, tagged fillin  filter  form  validation