views:

178

answers:

1

Let's say I have field that looks like this in the view:

<li class="bigfield">
  <?php echo $form->input('phone', array('placeholder' => 'Phone','label' => false,'between' => '<br />')); ?>
</li>

If I have a validation rule on this field and validation fails, I see the following HTML:

<li class="bigfield">
  <div class="input text required error">
    <br><input name="data[Appointment][email]" type="text" placeholder="Email" maxlength="45" value="" id="AppointmentEmail" class="form-error">
      <div class="error-message">Please enter a valid email address</div>
  </div>
</li>

I'm like to do something like move the error message div to an entire different part of the page rather then have it inside with the same <li> as the field itself. What would be the most straight forward way of doing this?

A: 

In you controller:

$this->set('validationErrorsArray', $this->ModelName->invalidFields());

You will have $validationErrorsArray in your views.

bancer