[eluser]Volder[/eluser]
I created a simple controller test.php:
Code:
<?php
class Test extends Controller{
function index()
{
$this->load->library('form_validation');
$rules = array(array('field' => 'text_field',
'label' => ' ',
'rules' => 'trim|required'
));
$this->form_validation->set_rules($rules);
$this->form_validation->run();
$this->load->view("v_test");
}
}
and a simple view v_test.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<title>Validation Test!</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<p>From validation: <?=set_value('text_field')?></p>
<p>From input: <?=$this->input->post('text_field')?></p>
<form action = '/test/' method='post'>
<input type="text" name="text_field" value="<?=set_value('text_field')?>" />
<input type="submit" value="Validate"/>
</form>
</body>
</html>
the question is the following:
I don't use htmlspecialchars function in validation rules for my field - but why the function set_value() produces transformed special characters?
So for example I inputed the value
Code:
<a href="http://test">test</a>
and all special chars are transformed to entities.
Is there any way to leave it untouched in validation?