Jump to content


This topic is now archived and is closed to further replies.


Change Error Message Color

Recommended Posts

Hi all,

pls, how can i change the error message color to red?




<?php echo form_open('form'); ?>

<h5>First Name:</h5>
<?php echo form_error('fname'); ?>
<input type="text" name="fname" value="<?php echo set_value('fname'); ?>" size="50" />
<?php echo form_error('sname'); ?>
<input type="text" name="sname" value="<?php echo set_value('sname'); ?>" size="50" />

<h5>Email Address</h5>
<?php echo form_error('email'); ?>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />

<?php echo form_error('password'); ?>
<input type="password" name="password" value="<?php echo set_value('password'); ?>" size="50" />

<h5>Password Confirm</h5>
<?php echo form_error('passconf'); ?>
<input type="password" name="passconf" value="<?php echo set_value('passconf'); ?>" size="50" />

<div><input type="submit" value="Submit" /></div>


Share this post

Link to post
Share on other sites

I assume you are using CodeIgniter?


By default form_error() places the error inside [tt<p></p>[/tt] tags. You can change these tags though, and define a CSS class.


<?php echo form_error('passconf', '<p class="error"');


You can use the third parameter to close a tag other than <p>.


<?php echo form_error('passconf', '<div class="error">', '</div>');


Or, you can set the error delimiters globally.


$this->form_validation->set_error_delimiters('<div class="error"', '</div>');


Check the docs for more information.

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.