[eluser]bobbob[/eluser]
My controller has this in it:
Code:
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Friend name', 'trim|required|min_length[2]|max_length[30]|xss_clean');
$this->form_validation->set_rules('name1', 'Friend name', 'trim|min_length[2]|max_length[30]|xss_clean');
$this->form_validation->set_rules('name2', 'Friend name', 'trim|min_length[2]|max_length[30]|xss_clean');
$this->form_validation->set_rules('name3', 'Friend name', 'trim|min_length[2]|max_length[30]|xss_clean');
$this->form_validation->set_rules('name4', 'Friend name', 'trim|min_length[2]|max_length[30]|xss_clean');
$this->form_validation->set_rules('message', 'Message', 'trim|required');
$this->form_validation->set_rules('known_name', 'Known Name', 'trim|required');
$this->form_validation->set_rules('email', '1st Email', 'trim|required|valid_email');
$this->form_validation->set_rules('email1', '2nd Email', 'trim|valid_email');
$this->form_validation->set_rules('email2', '3rd Email', 'trim|valid_email');
$this->form_validation->set_rules('email3', '4th Email', 'trim|valid_email');
$this->form_validation->set_rules('email4', '5th Email', 'trim|valid_email');
if ($this->form_validation->run() == FALSE)
{
$data['title'] = 'Tell a friend';
$data['header'] = $this->load->view('header',$data);
$this->load->view('tell/tell_friend_view', $data);
}
else
{
//some email function...
echo "success";
}
So the form calls this function and so does any link to the tell a friend page.
If there is a way of validating the form so that the whole page is loaded with the validation errors when there are some or if there are none for the response to just go in the div tag saying Success?
My question is how to prevent the response from an ajax call from returning to the div?