Do you know withInput() and Validation errors? |
redirect()->withInput() and Validation errors have an undocumented behavior.
If you redirect with withInput(): PHP Code: if (! $this->validate($rules)) { You can use the Validation object with the validation errors in the previous page. PHP Code: <?= service('Validation')->listErrors() ?> But this feature has bugs or design flaw. So I would like to remove the feature, and add a new helper function to get the validation errors. Any opinion?
Sounds great to me.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
@kenjis of cause at earlier from CI 4.0 I didn't know what to do with redirect withinput back and get a specific error because of CI documentation The global return
PHP Code: redirect()->back()->withInput(); PHP Code: <?= service('Validation')->listErrors() ?> @kenjis I truly have been using this global CI PHP Code: redirect()->back()->withInput(); PHP Code: redirect()->back()->withInput()->with('danger/*success*/',/*In modal*/$this->modal->errors() /*or something else apart with modal */); PHP Code: session()->get('danger/*success*/'); / but I may have a view of the point that it could be good if you design a new helper function and may have a specific single error validation result perimeter or with multiple validations on its parameter something like that or this PHP Code: redirect()->back()->withInput(); in additionally, Why this PHP Code: redirect()->back()->withInput(); Code: routes priority PHP Code: redirect()->to(current_url())->withInput(); Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
The undocumented redirect()->withInput() and Validation errors behavior was treated as a bug.
It won't work, so do not use it. Since v4.3, you can use Form helper validation_list_errors() (and validation_errors(), validation_show_error()). See https://github.com/kenjis/ci4-validation...rm2.php#L7
Added explanation to README.
https://github.com/kenjis/ci4-validation...ial#readme |
Welcome Guest, Not a member yet? Register Sign In |