I have no clue why I am having such a hard time with this, I have used
the symfony form validation before, but for some reason I just can't
get the errors messages to display using the renderGlobalErrors() form
method. the $form['field']->hasError() works and I am using it to turn
the input box borders red, but I also want the error messages.
Is there something special I need to turn on, include or configure? I
have been trying all day, reading the Forms sections from the
tutorials and still have not see what I am missing.
propel form object configure() method
[code]
$this->validatorSchema['password'] = new sfValidatorAnd
(array(
$this->validatorSchema['password'],
new sfValidatorString(array('required' => true,
'min_length' => 5),
array('required' => 'Password is required'))));
$this->validatorSchema['email'] = new sfValidatorAnd(array(
$this->validatorSchema['email'],
new sfValidatorEmail(array(), array('invalid' => 'The
email address
is invalid.'))));
$this->validatorSchema['address_1'] = new sfValidatorAnd(array(
$this->validatorSchema['address_1'],
new sfValidatorString(array('required' => true))));
[/code]
html (crud) generated template
[code]
<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>
<form action="<?php echo url_for('user/'.($form->getObject()->isNew
() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form-
>getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart
() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
<table class="entry-table">
<tfoot>
<?php if(!$form->getObject()->isNew()) : ?>
<tr>
<th>Created At: </th>
<td><?php echo $form->getObject()->getCreatedAt(); ?></td>
</tr>
<tr>
<th>Updated Last:</th>
<td><?php echo $form->getObject()->getUpdatedAt(); ?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2"><?php echo $form->renderHiddenFields() ?>
<a href="<?php echo url_for('user/index') ?>">Cancel</a>
<?php if (!$form->getObject()->isNew()): ?>
<?php echo link_to('Delete', 'user/delete?id='.$form-
>getObject()->getId(), array('method' => 'delete', 'confirm' => 'Are
you sure?')) ?>
<?php endif; ?>
<input type="submit" value="Save" /></td>
</tr>
</tfoot>
<tbody>
<?php echo $form->renderGlobalErrors() ?>
<tr>
<td colspan="2" class="section-header">Login Information</td>
</tr>
[/code]
Thanksl
--
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=.