Welcome Guest, Not a member yet? Register   Sign In
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



Theme © iAndrew 2016 - Forum software by © MyBB