[eluser]tirso[/eluser]
hi to all
What's wrong for my code, I want to change the background of field if error. Display message is work's fine only applying css.
any suggestion would greatly appreciated
thanks in advance
Tirso
here is my controller
Code:
function signup(){
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
if ($this->form_validation->run() == FALSE){
$html['page'] = 'wishlist/signup';
$this->load->view('template_wishlist',$html);
}
else{
$html['page'] = 'wishlist/signup';
$this->load->view('template_wishlist',$html);
}
}
this will display message which is no problem
Code:
<div style="width: 340px" align="center">
<?php
echo validation_errors('<div class="error">', '</div>');
?>
</div>
in my view to apply my css
Code:
<input name="username" type="text" class="highlight5" id="username" size="30" class="<?php echo (form_error('username') == '') ? '': 'highlight-field';?>"/>