Monday, June 11, 2012

List Form Errors in Symfony

<?php if( $form->hasErrors() || $form->hasGlobalErrors() ) : ?>
  
    <?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php $errors = $form->getErrorSchema()->getErrors() ?> <?php if ( count($errors) > 0 ) : ?> <?php foreach( $errors as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php endif; ?>
<?php endif; ?>

No comments:

Post a Comment