Show name “corrupted” when validation fails |
I'm having this name field
PHP Code: <?php echo form_label('Your Name <span class="required">*</span>', 'name', array('class' => 'col-sm-3 control-label')); ?> and these are the validation rules PHP Code: $config = array( I've spotted an issue when trying to validate the field. If I type a name like Mc'Donalds and hot submit I get this from set_value() Mc'Donalds How can I fix this issue ? I 've tried using htmlscecialcars_decode() and html_entity_decode() with ENT_QUOTES or ENT_COMPAT, but didn't do the trick
I am not sure I understand the problem as the example you have given looks right.
However, set_value works like this: You have PHP Code: set_value('name', $this->input->post('name')) // **** Not correct use of second term When it should be just PHP Code: set_value('name', '') The second term on the set_value should be your default, or nothing was submitted value, not the input post value. That is done with the first term, in your case 'name', so it looks for any post value with that post name and uses that, or if not found, uses the default term, the second term. You can see it explained much better here: http://www.codeigniter.com/userguide3/he...#set_value Hope that helps, Paul
“corrupted” because the value was escaped. Set 3rd variable on set_value() to false. set_value('name','Your name',FALSE);
Keep calm.
|
Welcome Guest, Not a member yet? Register Sign In |