Welcome Guest, Not a member yet? Register   Sign In
validation dunamically created fields
#1

[eluser]dimis[/eluser]
I have this function for validation of a form
Code:
function myvalidproduct()
    {
        //   $lancode=array();
        $lancode=$this->lans->returnonlycode();
        $this->load->library('validation');

        $fields['code']= "code";
        //  $fields['active']= "active";
        //  $fields['material']= "material";
        foreach ($lancode as $lan)
        {
            $el="name_".$lan['lan_code'];
            $fields[$el]= "$el";
            $rules[$el]= "required";

        }
        $rules['code']    = "required";
        //   $rules['active']    = "active";
        //  $rules['material']    = "material";
        $this->validation->set_fields($fields);
        $this->validation->set_rules($rules);
    }
... $this-> myvalidproduct();

But the code
Code:
foreach ($lancode as $lan)
        {
            $el="name_".$lan['lan_code'];
            $fields[$el]= "$el";
            $rules[$el]= "required";

        }
does not work. I have some text inputs with name name_gr, name_en,name_it etc that have last 2 letters from database.
HOw can I fix it and validtaete thiw inputs


Messages In This Thread
validation dunamically created fields - by El Forum - 09-17-2008, 12:48 AM
validation dunamically created fields - by El Forum - 09-17-2008, 12:55 AM
validation dunamically created fields - by El Forum - 09-17-2008, 01:08 AM
validation dunamically created fields - by El Forum - 09-17-2008, 01:52 AM
validation dunamically created fields - by El Forum - 09-17-2008, 01:53 AM
validation dunamically created fields - by El Forum - 09-17-2008, 02:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB