Welcome Guest, Not a member yet? Register   Sign In
set_value
#1

[eluser]quasiperfect[/eluser]
hi

i was working on a project and i observed that is you use set_value but the form validation is not built set value sets the value to empty even if the post contains something

is this intended behavior or a bug ?

to test download ci set library form_validation and url helper to autoload

in view welcome_message.php add a form
Code:
<form method="post" action="<?php echo base_url();?>">
<input type="text" class="input" name="test" value="<?php echo set_value('test');?>">
<input type="submit" value="submit">
</form>

in welcome controller add
Code:
$this->output->enable_profiler(true);
$this->form_validation->set_rules('test','test','required');
$this->form_validation->run();

load the page and write something in the field and submit the form
the form is populated and the post contains the value
comment or remove the line
Code:
$this->form_validation->set_rules('test','test','required');

resubmit the form now the form is not populated anymore




Theme © iAndrew 2016 - Forum software by © MyBB