CodeIgniter Forums
Add HTML in custom error message - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Add HTML in custom error message (/thread-78848.html)



Add HTML in custom error message - eleumas - 03-18-2021

Hi, i need to add a link in is_unique error custom message. How can i do?

PHP Code:
'email'     => [
        'label'   => lang('Main.formLabelEmail'),
        'rules'   => 'required|valid_email|is_unique[utenti_it.email,email,$email]',
        'errors' => [
                'is_unique' => 'your email is registred. Please follow this <a href="https://mylink.com">link</a>',

            

Thanks for help me.


RE: Add HTML in custom error message - kenjis - 03-18-2021

You can create custom error template:
https://codeigniter4.github.io/CodeIgniter4/libraries/validation.html#customizing-error-display