Welcome Guest, Not a member yet? Register   Sign In
Multiple form validation problem
#1

[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


Messages In This Thread
Multiple form validation problem - by El Forum - 02-17-2012, 09:17 AM
Multiple form validation problem - by El Forum - 02-17-2012, 10:44 AM
Multiple form validation problem - by El Forum - 02-17-2012, 11:16 AM
Multiple form validation problem - by El Forum - 02-18-2012, 07:55 AM
Multiple form validation problem - by El Forum - 02-18-2012, 08:40 AM
Multiple form validation problem - by El Forum - 02-18-2012, 08:49 AM
Multiple form validation problem - by El Forum - 02-20-2012, 04:27 AM
Multiple form validation problem - by El Forum - 02-20-2012, 04:30 AM
Multiple form validation problem - by El Forum - 02-20-2012, 06:27 AM
Multiple form validation problem - by El Forum - 02-20-2012, 07:11 AM
Multiple form validation problem - by El Forum - 02-21-2012, 02:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB