[eluser]dandys997[/eluser]
Hi again!
I decided to give my application's user an opportunity to edit their profiles. At first - suitable model method returns user data to fill all fields with. Then, in the controller, there's a code:
Code:
$this->form_validation->set_rules("nazwa", "required");
if($this->form_validation->run()==FALSE)
{
$dane=$this->Uzytkownik->dane($id);
$data=array("tytul" => "Edytuj użytkownika", "dane" => $dane, "id" => $id);
$this->load->view("panel_edytuj_uzytkownika", $data);
}
I use this data in a view:
Code:
echo form_open_multipart("panel/edytuj_uzytkownika/" . $id);
$this->table->add_row("Nazwa:", form_input("nazwa", set_value("nazwa", $dane->nazwa)));
$image_properties = array("src" => $dane->avatar, "width" => "64", "height" => "64");
$this->table->add_row("Avatar:", img($image_properties));
$this->table->add_row("Zmień avatar:", form_upload("userfile", set_value("userfile")));
echo $this->table->generate();
echo form_submit("submit", "Zmień");
echo form_close();
When I invoke above controller method, I successfully get a form with the data filled in "nazwa" field. But when I clear this field and try to post it empty, there's no errors from form_validation class, despite I've set the rule for this field. It behaves like if there weren't any rules or the field was filled correctly - but it isn't.
What's wrong? How to correct it? Thanks in advance for help!