[eluser]ppwalks[/eluser]
I have 2 forms on an include in a sidebar and I want to validate them both seperatley but the problem I have is if I click the button on one form it validates them both, the issue of them working within a sidebar I have figured out but I can get them to validate individualy.
Heres the code:
Code:
function validateQuickQuote() {
$this->form_validation->set_rules('name', 'name', 'required|min_length[3]');
$this->form_validation->set_rules('email', 'email', 'required|valid_email');
$this->form_validation->set_rules('contact', 'Telephone', 'required|numeric|min_length[9]|is_uk_num');
$this->form_validation->set_rules('date', 'Expected Date', 'required');
$this->form_validation->set_rules('moving_frm', 'Moving From', 'required');
$this->form_validation->set_rules('moving_to', 'Moving To', 'required');
}
function validateSubscribe() {
$this->form_validation->set_rules('sub_name', 'name', 'required|min_length[3]');
$this->form_validation->set_rules('sub_email', 'email', 'required|valid_email');
}
Above is my model code
Now my controller
Code:
function index()
{
$data['action'] = "index";
$data['title'] = "";
$data['main'] = 'home_main';
$data['side'] = 'sidebar';
$data['testim'] = $this->MRemovals->getRandomTestimonials(3);
$data['latestNews'] = $this->MPosts->getFrontPagePosts();
$data['latestPromos'] = $this->MPosts->getFrontPagePromos();
$this->MRemovals->validateSubscribe();
$this->MRemovals->validateQuickQuote();
if ($this->form_validation->run() == FALSE)
{
$this->load->vars($data);
$this->load->view('index');
}
I have tried an
Code:
if ($this->input->post('quick-quote')) {
wrapped around each function and even tried an if / else within the contrioller but still nothing.
Can anyone assist with this as it is driving me insane...
Thank you in advance
Paul