CodeIgniter: ile teslim formu

0 Cevap php

I have this problem with CodeIgniter: - when I click the submit button in a form, the form is submitted and validated correctly - when I don't click the submit button, just hit <enter>, the form validation always fails Any solution? Is that a flaw in CI's form validation or am I missing something?

Orada ne kodu:

--- the form view ---

form_open("/");
...some inputs...
echo form_submit('submit', 'Přihlásit');
form_close();
...

--- the controller ---

$this->CI->load->helper('form');  
$this->CI->load->library('form_validation');

$this->CI->form_validation->set_rules('id_uziv', 'ID', 'required');   
$this->CI->form_validation->set_rules('heslo', 'Heslo', 'required');  
//... see, no rules have anyhting to do with the submit button

if ($this->CI->form_validation->run() == FALSE) {
  // validation OK
}
else {
  // validation failed
}

0 Cevap