Welcome Guest, Not a member yet? Register   Sign In
Need help for CSRF/XSS and form validation

1. In CI4, how to escape data during form submission? If i need to escape tags or CSS codes, how to do this? I want to work with HtmlSanitizer.

2. My validation rules are:
PHP Code:
$rules = [
    "inputName1" => "required",
    "inputName2" => "required",
if( ! 
$this->validate($rules) ) 
    return = array('FAILED!'json_encode($this->validator->getErrors())); 

a) How to set name for the each input in error message?
b) As i am submitting the form with AJAX, validation error always executing the success block with validation error message. Ajax is not getting the error headers. How to solve this?

3. How to set custom error header code and message in CI 4?

Thanks in advance and sorry for too many questions.
"Who thinks in code"
Perfectly describes who I am


1. does this help: https://codeigniter4.github.io/userguide...nction#esc
2. (a) try this: https://codeigniter4.github.io/userguide...your-rules
(b) when the form is submitted what does it return?
3. try this: https://codeigniter4.github.io/userguide...validation

Theme © iAndrew 2016 - Forum software by © MyBB