Welcome Guest, Not a member yet? Register   Sign In
v4.3.1 released
#13

(01-22-2023, 08:11 AM)chronic Wrote:
(01-22-2023, 05:49 AM)kenjis Wrote: I don't know why you can't use validation_show_error('email');

The following code works as before after you run validation.
PHP Code:
if ($validation->hasError('username')) {
    echo $validation->getError('username');


If you have code like this,
PHP Code:
if (! $this->validate($rules)) {
    return redirect()->back()->withInput();

you are redirected after the validation fails.
In the next request, validation never run.
So you no longer can use $validation->getError() or hasError().

That is, if you don't redirect after the validation fails,
you can use $validation->getError() or hasError().

Ok thanks kenjis now everything is clearer to me.

But even to me it's a mystery that it doesn't work (it shows nothing):

PHP Code:
echo validation_show_error('email'); 

Instead this shows the error correctly:

PHP Code:
if (isset($errors['email']))
{
    echo $errors['email'];


Ok I found my problem, it was due to my "single" custom templates specified in Config/Validation.php.

Thanks again kenjis, and sorry for boring you
Reply


Messages In This Thread
v4.3.1 released - by kenjis - 01-14-2023, 04:38 AM
RE: v4.3.1 released - by nc03061981 - 01-14-2023, 06:12 AM
RE: v4.3.1 released - by kenjis - 01-14-2023, 05:44 PM
RE: v4.3.1 released - by nc03061981 - 01-14-2023, 09:29 PM
RE: v4.3.1 released - by InsiteFX - 01-14-2023, 11:39 PM
RE: v4.3.1 released - by oyama-pai - 01-18-2023, 07:24 AM
RE: v4.3.1 released - by kenjis - 01-19-2023, 02:45 AM
RE: v4.3.1 released - by chronic - 01-21-2023, 04:37 PM
RE: v4.3.1 released - by kenjis - 01-21-2023, 05:34 PM
RE: v4.3.1 released - by chronic - 01-22-2023, 04:54 AM
RE: v4.3.1 released - by kenjis - 01-22-2023, 05:49 AM
RE: v4.3.1 released - by chronic - 01-22-2023, 08:11 AM
RE: v4.3.1 released - by chronic - 01-22-2023, 10:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB