• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.