Welcome Guest, Not a member yet? Register   Sign In
where to set error messages?
#1

[eluser]mehwish[/eluser]
hi can anyone tell me where to set error messges while validating the form ..

for example i hve the following code

Code:
<h5>Enter first name</h5>
&lt;input type="text" id="id" name="firstname" value=" &lt;?php echo set_value('firstname');?&gt; " size="50" /&gt;
&lt;?php echo form_error('firstname'); ?&gt;

i know this i have written some error message for the field first name some where( when validation rule written for field first name is not valid) but not remember where
#2

[eluser]tmfl[/eluser]
in your controller insert the following

Code:
$this->load->library('form_validation');
$this->form_validation->set_message('required', 'Required Field');
$this->form_validation->set_rules('firstname', 'First Name', 'required');

I would also change the name of your input id to match the input name




Theme © iAndrew 2016 - Forum software by © MyBB