[eluser]bibstha[/eluser]
I've been spending quite some time with set_value error in CodeIgniter.
In my config/form_validation.php file
i've set the $config variable as
Code:
<?php
$config = array(
'events/create_form' => array(
array(
'field' => 'title',
'label' => 'Event name',
'rules' => 'required',
)
),
);
?>
Now the actual form which contains the textarea
title has other field
objective.
Code:
<form >
<?php print form_input('title',set_value('title','enter name')); ?>
<?php print form_textarea('objective',set_value('objective','enter objective')); ?>
</form>
Now on invalid error, title is populated from the $_POST while objective isn't.
I looked through the source and found out that when form_validation is loaded, it actually calls
class CI_Form_validation:
et_value(). But CI_Form_validation:
et_value only works for values already in the validation $config variable.
So the code is returning empty text.
Can anyone confirm this as a bug? Or am I missing some part?