EDITED
CakePHP Version: 2.2.4
When an input validation falis the error message that CakePHP generates is positioned after my input element
<div class="control-group">
<label class="control-label">Name <span class="required-field">*</span></label>
<div class="controls">
<input name="data[User][name]" class="input-xlarge form-error" type="text" value="">
<div class="error-message">This field cannot be left blank.</div>
<input type="hidden" name="data[User][public_name]" id="UserPublicName_" value="0">
<input type="checkbox" name="data[User][public_name]" class="span1" value="1">
</div>
</div>
But I want to place it after my checkbox, like this:
<div class="control-group">
<label class="control-label">Name <span class="required-field">*</span></label>
<div class="controls">
<input name="data[User][name]" class="input-xlarge form-error" type="text" value="">
<input type="hidden" name="data[User][public_name]" id="UserPublicName_" value="0">
<input type="checkbox" name="data[User][public_name]" class="span1" value="1">
<div class="error-message">This field cannot be left blank.</div>
</div>
</div>
I’ve read FormHelper::input() but I can’t figure how I can do it. I would like to use inputDefaults.
EDITED
My .ctp
<div class="control-group">
<label class="control-label">Nanme <span class="required-field">*</span></label>
<div class="controls">
<?php
echo $this->Form->input('name', array(
'type' => 'text', 'class' => 'input-xlarge'));
echo $this->Form->checkbox('public_name', array('class' => 'span1'));
?>
</div>
</div>
Actually I’ve resolved it. I’ve add
'error' => falseand positioned the error message where I wanted with$this->Form->error()My .ctp