Welcome Guest, Not a member yet? Register   Sign In
Form Validation Issue
#1

(This post was last modified: 12-16-2022, 11:51 AM by rolf.)

Hi there,
I've been staring at an issue for some hours now.
PHP Code:
# Load dependencies
$validation = \Config\Services::validation();
$request = \Config\Services::request();

# Set filter rules
$validation->setRule('inv_firmname''Bedrijfsnaam''required');

# Validate the form
if ($validation->run() == false)

       
print_r($validation->getErrors());
       
print_r($request->getPost());

       
# Set validation errors
       
setNotification($validation->listErrors(), "error");


The form seems to work just fine and the data is easily accessible with getPost(). So the form was submitted correctly and the field was filled in too.
However, the Validator keeps telling me that the field is required.

So it's returning both the Errors and the $_POST data. But the Validator says there's no data.
Is this a known issue?

Any ideas or suggestions here are really appreciated.
Reply
#2

$validation->run() requires data to validate as the first parameter.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB