CodeIgniter Forums

Full Version: Vary specific form_error error messages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]walrus_lt[/eluser]
Hello, i have an idea to add specific form error messages.

Here is an example

Code:
// config/form_validation.php
$config = array(
  'member/signup' => array(
'field' => 'username',
'label' => 'Username',
'rules' => 'required|max_lenght[5]',
  )
);

This will produce, for example: "Username is to long". It's ok, but in my language (lithuanian) or other, there need to be very specific messages.......

So, i offer to add feature, to add label to each rule check, for example:

Code:
// config/form_validation.php
$config = array(
  'member/signup' => array(
'field' => 'username',
'label' => 'Username is required|Username is to long',
'rules' => 'required|max_lenght[5]',
  )
);

or

Code:
// config/form_validation.php
$config = array(
  'member/signup' => array(
'field' => 'username',
'label' => 'Username', // default label, only one allowed, in %s, If need other (like lower case word, then need to write text in "simple way")...
'rules' => 'required|max_lenght[5]|min_lenght[2]',
'labels'=> '%s is required|%s is to short|The username cannot be shorten than %s lenght..'
  )
);

It would be very cool if there would be this feature, and if paste new form_validation.php here Smile

And sorry for poor english, i hope you understand Smile