私はcodeigniterの開発に不慣れです。次のように簡単なログインフォームを作成しました。
login_viewページで
<?php echo validation_errors(); ?>
//my form html code comes here
私のコントローラーページで
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('login_view',$data);
}
else
{
//form validated do some work here
}
ここで問題となるのは、ユーザー名とパスワードのフィールドが空のフォームを送信すると、次のようなエラーが表示されることです。
The Username field is required.
The Password field is required.
これは正しいですが、私は単一のメッセージのみを次のように表示したいと思います
Please enter username and password......
フィールドごとに2つまたはN個のメッセージの代わりに。すでにform_error('fieldname')関数を試しましたが、使用できません。上記の出力を取得するにはどうすればよいですか。
前もって感謝します。