Jump to content

Recommended Posts

Hi all,

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

 

thanks

 

<?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" />
<h5>Surname:</h5>
<?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" />

<h5>Password</h5>
<?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>

</form>

Link to comment
https://forums.phpfreaks.com/topic/260504-change-error-message-color/
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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.