public function testErrorMessageFor() { $this->post->errors['title'] = 'Title can\'t be empty'; $this->post->contentAttributes = array(new SAttribute('title', 'string')); $this->assertDomEqual(error_message_for('post', $this->post), '<div id="form-errors" class="form-errors"> <h2>Please correct the following errors :</h2> <ul> <li><a href="#" onclick="Field.focus(\'post_title\'); return false;">Title can\'t be empty</a></li> </ul> </div>'); $this->assertDomEqual(error_message_for('post', $this->post, array('id' => 'bad-errors', 'header_tag' => 'h5')), '<div id="bad-errors" class="form-errors"> <h5>Please correct the following errors :</h5> <ul> <li><a href="#" onclick="Field.focus(\'post_title\'); return false;">Title can\'t be empty</a></li> </ul> </div>'); }
<h1>New <?php echo $this->singular_name; ?> </h1> <p><?php echo link_to('Back', array('action' => 'index')); ?> </p> <?php echo error_message_for($this->singular_name, $this->{$this->singular_name}); echo form($this->singular_name, $this->{$this->singular_name}, array('action' => 'create')); ?> <p><?php echo link_to('Back', array('action' => 'index')); ?> </p>
public function error_message_for($options = array()) { return error_message_for($this->objectName, $this->object, $options); }