[eluser]boltsabre[/eluser]
Quote:My understanding was that the colour of the label text would change to red ....Why is it creating another label ?
Because you are echoing it out via:
Code:
<?php echo form_error('firstname'); ?>
So you've got your first label hard coded, followed by your input, and if validation fails, you're also echoing out the second label. Just use a span or div instead if you'd prefer?
Code:
$this->form_validation->set_error_delimiters('<div class="error">','</div>')
Quote:Secondly, if I want to change the position of the error message to inside the input box, how do I achieve this ?
I'd actually advise against this method, it's not very user friendly... you'll override what the user entered. They won't be able to see what they entered the first time round to see why they got the error message. It would be okay for just this for with just a "required" validation, but I'd steer clear of it anyway. I'd just echo them out either under your inputs that fail, or one message per line either at the top or bottom of the form.
But I think this would do it (maybe, im at work, not at home, I can't check atm) if you really want to go down that road:
Code:
//remove this line of code from your controller
$this->form_validation->set_error_delimiters('<div class="error">','</div>')
Code:
value="<?php echo set_value(form_error('firstname'));?>"