Welcome Guest, Not a member yet? Register   Sign In
Has anyone notices any bug with FormValidator
#1

[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. Sad

I looked through the source and found out that when form_validation is loaded, it actually calls
class CI_Form_validation:Confusedet_value(). But CI_Form_validation:Confusedet_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?
#2

[eluser]Evil Wizard[/eluser]
The input field works different to the text are field.
Code:
<input name="input_tag" type="text" value="my input value" />
<textarea name="textarea_tag" rows="8" cols="25" value="not the value of the the textarea">
this is the text value of the textarea input
</textarea>
what you would be better off doing in the textarea is
Code:
<textarea name="objective">
<?=set_value('objective','enter objective');?>
</textarea>
That will repopulate the textarea.




Theme © iAndrew 2016 - Forum software by © MyBB