• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form validation for field create with jquery

#2
You could try something like this:
(Not tested, probably full of bugs)
PHP Code:
$fields count($this->input->post());
for (
$i=1$i <= $fields; ++$i
{
    if ( ( ! empty(
$this->input->post('article'.$i)) AND ( ! empty($this->input->post('quantity'.$i)) )
    {
        
$this->form_validation->set_rule('article'.$i'Article '.$i'required');
        
$this->form_validation->set_rule('quantity'.$i'Quantity '.$i'required|integer');
    }


I think that should work. May not be the cleanest or neatest way to achieve this but it is one possible way.

Paul.
Reply


Messages In This Thread
RE: Form validation for field create with jquery - by PaulD - 12-05-2017, 12:01 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.