Skip to content

Instantly share code, notes, and snippets.

@eduardoromero
Last active December 11, 2015 16:59
Show Gist options
  • Save eduardoromero/4631636 to your computer and use it in GitHub Desktop.
Save eduardoromero/4631636 to your computer and use it in GitHub Desktop.
Foundation -> Cake Input dissected.
<?php echo $this->Form->create('Cliente', array('id' => 'empresa-add', 'class' => 'custom', 'inputDefaults' => array('div' => false, 'label' => false, 'class' => '', 'error' => array('wrap' => 'small', 'class' => '')))); ?>
<div class="row">
<?php $input_error = $this->Form->isFieldError('telefono') ? 'error': ''; ?>
<div class="six columns <?php echo $input_error ?>">
<?php echo $this->Form->input('telefono', array('type' => 'text', 'placeholder' => 'Teléfono', 'class' => '')); ?>
</div>
<?php $input_error = $this->Form->isFieldError('contacto') ? 'error': ''; ?>
<div class="six columns <?php echo $input_error ?>">
<?php echo $this->Form->input('estado', array('contacto' => 'text', 'placeholder' => 'Contacto', 'class' => '')); ?>
</div>
</div>
@eduardoromero
Copy link
Author

We disable divs and labels and add Foundation's row + cols divs and define how the errors are going to be wrapped:

'inputDefaults' => array('div' => false, 'label' => false, 'class' => '', 'error' => array('wrap' => 'small', 'class' => '')))
<?php $input_error = $this->Form->isFieldError('field') ? 'error': ''; ?>

Is used to add an error class to the div that holds the input. Marking it as with error in a way that the User can easily identify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment