[eluser]Multisnet[/eluser]
I need some help please.. I'm trying to repopulate a form.
in controller:
Code:
function validateUserRegistration(){
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Name', 'required');
if ($this->form_validation->run() == FALSE){
$this->template->write_view('reg_conteudos_centro', 'paciente_form_registo');
$this->template->render();
}
else{
echo("Success!!");
}
}
in view:
Code:
(...)
<?=form_open('registo_p_ctr/validateUserRegistration'); ?>
<?php echo validation_errors(); ?>
<label>
<input name="name" type="text" id="name" style="width:280px;" value="<?php echo set_value('name'); ?>">
</label>
(...)
<?=form_close(); ?>
When the validation fails it shows again the form. The errors are displayed correctly, but the form doesn't show the values that user previously entered. However I could repopulate the form if i use $_POST['field_name'].
Could you help me? After reading for a while, I can't realize what I'm doing wrong..