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

(05-10-2020, 01:08 PM)jreklund Wrote: Oh, yeah. That's new... It looks for $_GET as well know. Don't think you can turn that off at the moment. You can hack it away with:

PHP Code:
if ($this->request->getMethod() === 'get' || !$validation->run()) 

hallo @jreklund,
i try your code but it still display error when i load the page for the first time,


in my controller :
PHP Code:
$val $validation->setRules([
            'email' => ['label' => 'Email''rules' => 'required|trim|valid_email'],
            'password' => ['label' => 'Password''rules' => 'trim|required'],
        ]);
        $data['title'] = 'Login Area';
        $data['validation'] = $validation;

        if ($this->request->getMethod() === 'get' || !$val->run()) {
            echo view('auth/login'$data);
        } else {
            $this->_login();
        

in my view
Code:
<div class="form-group">
                                <label>Email Address</label>
                                <input class="au-input au-input--full" type="email" name="email" placeholder="Email">



                                <div class="alert alert-danger" role="alert">

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

                            </div>

i use CI 4.0.3
Reply


Messages In This Thread
RE: Disable error message on a single rule in form validation - by sandywicaksono - 05-27-2020, 03:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB