1

I've updated EE from 2 to 5. I've a custom module where I need to validate a form. In the new EE 5 the function $this->EE->form_validation->error_array() does not exist anymore. I'm using it in the following function:

$this->EE->session->set_flashdata(
    'result_message',array(
        'post' => $_POST, 
        'errors' => this->EE->form_validation->error_array()
    )
);

Does someone has an answer for this?

0

I haven't used that legacy library in quite a while, but after a quick review of the code in EE 4.3.6 (which should be the same as 5.0.x), I think you can return a string of error messages like so for a Control Panel flash message:

...
'errors' => ee()->form_validation->error_string()
...

That class and function lives in system/ee/legacy/libraries/Form_validation.php and should return a carriage-returned string of errors you can use.

Remember that EE2 was running heavily on a version of CodeIgniter 2.x that EllisLab was maintaining, and in later versions of EE they stopped using that framework as a base. That framework is where the validation class originated, but now (in at least EE4 and EE5) they use a legacy library that has no dependencies on CodeIgniter anymore, so you can only use what lives in that legacy library file.

I think. Someone correct me if I'm wrong.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.