Welcome Guest, Not a member yet? Register   Sign In
Validation Always Print Error Message
#3

I had the same problem and thought it was its normal way of working while it checks if validation has passed and if not, shows the form. "If not" meaning there are errors. To solve this I added in my controller function
PHP Code:
$data['isPost'] = $this->request->getMethod()=='post'

And then in the html where I show the errors


Code:
<?php if($isPost) echo service('validation')->listErrors() ?>

That way only when the form is sent (if actually sent through post) will the errors show. If there is a better way, I'd be glad to hear it.
Reply


Messages In This Thread
RE: Validation Always Print Error Message - by ci_user99 - 04-01-2019, 01:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB