last day (22 days later) » 

5:17 AM
1
A: my form validation is not working properly for select box in codeigniter

Deep ParekhHello for your different message you need to define: For Message : $this->form_validation->set_rules('emp_name', 'Name', 'trim|required'); $this->form_validation->set_rules('emp_jdate', 'Joining Date', 'trim|required'); $this->form_validation->set_rules('emp_addr', 'Address', 'trim|...

 
your second solution is working ... but 1st has still show an error like "Unable to access an error message corresponding to your field name Designation.(select_validate)"
 
what u tried ??
 
as you give me the solution for message it's not working . i change set_message field as you show. you see i use two separate function for both message in controller. and thanks for second solution.
 
have solved your both issues?
 
no only second issue : For empty other fields this solution for Message is not working.
 
5:17 AM
ok you defined the set_message in other functions(that is select_validate and select_validate1). But try to define that after you defined all rules.
see my edited code and remove that two functions(that is select_validate and select_validate1)
 
ok i do what you say sir... delete the function and put the set_message under validation rule... still got the same error.
 
make sure your input name is city_id and desi_id
 
yes sir,,, i put it properly.
 
Okei put that functions agin as it is and i have checked your code properly u have call_back same function in city and desi. see this (callback_select_validate) where u set the rules.
 
ya but that's for the select box validation. they may have to be same for select box type. and if i change what i should i write there instead of that. the rules are may have same for same type.
 
5:17 AM
ok for city_id field you want display message like "Please select you city" ? and for desi the message should be "Please select your desi" Right ??
 
yes sir...i want the different message.
 
OK i got but you called same function where you set the rules for city_id and desi_id. for city_id ($this->form_validation->set_rules('city_id', 'City', 'trim|required|callback_select_validate')) that is perfect. But for desi_id it should be ($this->form_validation->set_rules('desi_id', 'Designation', 'trim|required|callback_select_validate1')) callback_select_validate1 so select_validate1 function should be call for desi.
got my point ????
 
Thanks.... sir... i got it... and thank you very much. kindly stay connected for more questions. again thanks.
 
solved now? if yes then accept my answer so it will help others... and vote it up :)
ok dear any time... :)
 
yes sir i accepted the answer and vote it up... thanks again sir. you made my day. thx :D
 
5:17 AM
ok i like and make ur que fav for ur repo... :)
 
sir got a problem in the validation.. now when i submit the form the error of designation field is still come and stop my form to submit... i select the value form designation select box but it show the error message.
 
if($abc = "none")
{
$this->form_validation->set_message('select_validate1', 'Please Select Your Designation.');
return false;
}
should be :
$this->form_validation->set_message('select_validate1', 'Please Select Your Designation.')
instead of
$this->form_validation->set_message('select_validate', 'Please Select Your Designation.')
 
hello sir
sir i done that...
but the select box prevent my form to submit. ..
after selecting a value it show the validation error and the stop the form execution.
 
 
2 hours later…
7:27 AM
@Feeds ys that's i said.OK now see your select_validation1 function. In that u write $this->form_validation->set_message('select_validate', 'Please Select Your Designation.') to set message for desi. But you define select_validation and u need to write select_validation1.
 
 
3 hours later…
10:10 AM
hello every one , my codeigniter site has been hacked, redirect to some other sites ... any suggestion ??
 

  last day (22 days later) »