Welcome Guest, Not a member yet? Register   Sign In
Disable error message on a single rule in form validation
#9

(This post was last modified: 06-04-2020, 06:04 PM by sandywicaksono.)

(06-01-2020, 02:37 PM)jreklund Wrote: You are assigning $validation, but execute $val. It's now to different functions.

Hi,


Code:
$validation = \Config\Services::validation();
        $validation->setRules([
            'email' => ['label' => 'Email', 'rules' => 'required|trim|valid_email'],
            'password' => ['label' => 'Password', 'rules' => 'trim|required'],
        ]);
if ($this->request->getMethod() === 'get' ||  !$validation->run()) {
            echo view('auth/login', $data);
        } else {
            $this->_login();
        }
in my view


Code:
<input class="au-input au-input--full" type="email" name="email" placeholder="Email">
                                <?php if (!$validation->showError('email')) : ?>

                                <?php else : ?>
                                    <div class="alert alert-danger" role="alert">

                                        <?= $validation->showError('email'); ?>
                                    </div>
                                <?php endif; ?>
                            </div>


[align=center]
but it still no work, give me a keyword or references if you know.?
Reply


Messages In This Thread
RE: Disable error message on a single rule in form validation - by sandywicaksono - 06-04-2020, 03:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB