Welcome Guest, Not a member yet? Register   Sign In
Loading the form and validating in the same function?
#1

[eluser]parham90[/eluser]
Hi,

It's the first time I am doing a function like this (loading of the form and validating in the same function), so I have to paste the whole function; sorry for the long post. But the form doesn't validate; the form just reloads, with no fields repopulated, even though I have used

Code:
<?=form_input('name', set_value('name'))?>

The function follows:

Code:
function contact()
{
$this->load->library('Recaptcha');
$this->load->library('form_validation');
$this->load->helper('form');
$this->lang->load('recaptcha');
if ($this->form_validation->run())
$this->load->view('success.php');
else
{
$this->form_validation->set_rules('email', 'email', 'required|valid_email');
$this->form_validation->set_rules('name', 'name', 'required|xss_clean');
$this->form_validation->set_rules('message', 'message', 'required|xss_clean');
$this->form_validation->set_rules('phone', 'phone', 'required|numeric');
$this->form_validation->set_rules('phone', 'phone', 'required|numeric');
$this->form_validation->set_rules('recaptcha_response_field', 'lang:recaptcha_field_name', 'required|callback_check_captcha');
$data['captcha'] = $this->recaptcha->get_html();
$this->load->view('contact', $data);
}
}

Thanks!


Messages In This Thread
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 08:40 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 08:45 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 08:57 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 09:05 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 09:09 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 09:10 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 09:45 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 10:18 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 10:42 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 11:40 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 11:58 AM
Loading the form and validating in the same function? - by El Forum - 04-29-2010, 04:26 PM
Loading the form and validating in the same function? - by El Forum - 04-30-2010, 12:50 AM
Loading the form and validating in the same function? - by El Forum - 04-30-2010, 03:32 PM
Loading the form and validating in the same function? - by El Forum - 04-30-2010, 10:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB