Welcome Guest, Not a member yet? Register   Sign In
Change Error Message Color
#1

[eluser]Zed[/eluser]
Hi all,
pls, how can i change the error message color to red?

thanks

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

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

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

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

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



<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;
#2

[eluser]Carmichael[/eluser]
Put this in the top of your file.

Code:
$this->form_validation->set_error_delimiters('<span class=error>', '</span>');

Code:
.error{
color: red;
}
#3

[eluser]Zed[/eluser]
[quote author="Zed" date="1333802620"]Hi all,
pls, how can i change the error message color to red?

thanks

Code:
&lt;?php echo form_open('form'); ?&gt;

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

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

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

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



<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;
[/quote]

will span change the color?
#4

[eluser]ludo31[/eluser]
Code:
&lt;?php echo form_error('titre','<span class="error">','</span>');?&gt;<br/>

and the css

.error{color:red;font-size:10px;}
#5

[eluser]Aken[/eluser]
Wow. You should step away from CodeIgniter and go back to website basics like HTML and CSS first.
#6

[eluser]Zed[/eluser]
[quote author="Aken" date="1333824215"]Wow. You should step away from CodeIgniter and go back to website basics like HTML and CSS first.[/quote]

yeah. so you said, but i did it just like css on html but it didnt work. i'd suggest if you feel you know all, stop coming to forums cos they are meant for asking for help regardless of how stupid some people might think the question might look. i believe, its always better to be pruned to grow than be cut off and cast in a fire.

thanks to all those who are rendering helping hands to people who needs them. i believe there are areas in life i can teach you a thing or two...
#7

[eluser]Zed[/eluser]
thanks all for you help. i used label instead of span cos span is giving me an output i don't like.

thanks a zillion dozen times




Theme © iAndrew 2016 - Forum software by © MyBB