CodeIgniter Forums
Validation messages displaying differently between local environment & server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Validation messages displaying differently between local environment & server (/showthread.php?tid=90874)



Validation messages displaying differently between local environment & server - hqualit - 05-16-2024

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?
          


RE: Validation messages displaying differently between local environment & server - kenjis - 05-16-2024

The lang file name is Validation.php, not validation.php.
Therefore you must write lang('Validation.required', ...
Read https://codeigniter.com/user_guide/outgoing/localization.html#language-localization


RE: Validation messages displaying differently between local environment & server - hqualit - 05-16-2024

(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/outgoing/localization.html#language-localization


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 ?



RE: Validation messages displaying differently between local environment & server - ozornick - 05-16-2024

The system has different case sensitivity. App != app


RE: Validation messages displaying differently between local environment & server - hqualit - 05-16-2024

(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


RE: Validation messages displaying differently between local environment & server - kenjis - 05-16-2024

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.


RE: Validation messages displaying differently between local environment & server - hqualit - 05-16-2024

(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