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

(05-10-2020, 10:11 AM)jreklund Wrote: That kinda what you asked, you only want it to validate if it's not empty. So remove "required" and add "permit_empty".

If it's possible to disable it, it would be by passing "null" or just an empty string for said message.

It's not trimmed, but that rule dosen't trim it, at least not for when you are saving it into the database. It dosen't touch your original data.

I'm migrating my code from CI3 to CI4. I will explain my problem.

I have a login page email/password associated to a single controller, when the user reaches the form for the first time, the form is empty, no message is display.

If the user try to login, but the validation fails, the login page is displayed with the appropriate error message ($validation->getErrors()) and the email is reported in the form with set_value().

Quit standard, CI should deal with it easily. 

The first time the user reaches the page, since there is no data posted, the validation fails and displays an error message because the field email is empty. Of course, I could check by my own if the field is provided without the form validation mechanism. But it was working with CI3.
Reply


Messages In This Thread
RE: Disable error message on a single rule in form validation - by imabot - 05-10-2020, 11:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB