Welcome Guest, Not a member yet? Register   Sign In
Validation messages displaying differently between local environment & server
#1

I am using Docker. 
When I run the project on local environment(windows 11), it gives validation error messages as 
The username field is required.
The password field is required.
But the same project on server(Linux) shows error messages as 
validation.required
validation.required
Both are running on PHP 8.3 and this is CI4 project
This is the part of the code that use for form validation.
$rules = [
                'username' => [
                    'rules' => 'required|string|min_length[5]|max_length[30]',
                    'errors' => [
                        'required' => lang('validation.required', ['field' => lang('users.usersInputUsername')]),
                    ],
                ],
                'password' => [
                    'rules' => 'required|min_length[6]',
                    'errors' => [
                        'required' => lang('validation.required', ['field' => lang('users.usersInputPassword')]),
                    ],
                ]

      ];
if($this->validate($rules){
}
Is there anyone who knows why is this occur?
          
Reply
#2

The lang file name is Validation.php, not validation.php.
Therefore you must write lang('Validation.required', ...
Read https://codeigniter.com/user_guide/outgo...calization
Reply
#3

(05-16-2024, 01:55 AM)kenjis Wrote: The lang file name is Validation.php, not validation.php.
Therefore you must write lang('Validation.required', ...
Read https://codeigniter.com/user_guide/outgo...calization


This works. Thank you so much. Why is this possible I am curious to know about this? What is the reason it works with validation in windows host ?
Reply
#4

The system has different case sensitivity. App != app
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply
#5

(05-16-2024, 04:26 AM)ozornick Wrote: The system has different case sensitivity. App != app
Since I'm using Docker, the application always runs within a Docker environment. Only the host changes where Docker container runs. That is why I am curious to know bit more about this
Reply
#6

The case sensitivity depends on the file system you are using.
Probably you put the project files on the Windows file system that is case insensitive.
Reply
#7

(05-16-2024, 05:25 AM)kenjis Wrote: The case sensitivity depends on the file system you are using.
Probably you put the project files on the Windows file system that is case insensitive.

thank you for the explanation
Reply




Theme © iAndrew 2016 - Forum software by © MyBB