I'm using Cake 1.0.1.2708 on PHP 4.3.11
I'm having trouble getting form validation to show errors. Basic
example:
model:
class Quote extends AppModel
{
var $name = 'Quote';
var $validate = array(
'start_date'=>VALID_NOT_EMPTY,
'finish_date'=>VALID_NOT_EMPTY);
}
controller:
class QuotesController extends AppController
{
var $name = 'Quotes';
function add()
{
if (empty($this->data))
{
$this->set('valid', 'no valid input');
$this->render();
}
else
{
if ($this->Quote->validates($this->params['data']))
{
$this->set('valid', 'valid input');
$this->set('data', $this->params['data']);
} else {
$this->validateErrors($this->Quote);
$this->set('data', $this->params['data']);
$this->set('valid', 'not valid input');
$this->render();
}
}
}
view(quotes/add.thtml):
<?php echo $html->tagErrorMsg('Quote/start_date', 'Start date is
required.') ?>
<?php echo $html->tagErrorMsg('Quote/finish_date', 'Finish date is
required.') ?>
<p><?php echo $valid ?></p>
<p><?php echo pr($data) ?></p>
In the view $valid is correct, but tagErrorMsg doesn't show any error
message
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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/cake-php
-~----------~----~----~----~------~----~------~--~---