Welcome Guest, Not a member yet? Register   Sign In
form_validation messes up the POST
#1

[eluser]Unknown[/eluser]
I have a controller that performs the form_validation check:

Code:
function sample_form() {

  if ($this->form_validation->run() == TRUE) {
    $this->load->view('success_view');
  }

}

And the "success_view" view that represents the data:
for example:

Code:
<?php
  echo set_value('name');
  echo set_value('surname');
  echo set_value('note');
?>

There is also a $config array in form_validation.php that sets the default validation rules for a controller:

Code:
$config = array(
  'sample_ctrl/sample_form' =>
    array(
      array('field' => 'name', 'label' => 'Name', 'rules' => 'required'),
      array('field' => 'surname', 'label' => 'Surname', 'rules' => 'required')
    )
);

The validation works as it should on "name" and "surname", but the "note" seems to be the problem. It has no set validation rule and it allows anything to be input, but the problem is that the set_value('note') does not refill the textbox when I submit the form (the code was not written for brevity).

Even more strange thing is that when I add an empty rule to the $config array, everything works fine and set_value refills the input textbox as intended:

Code:
array('field' => 'note', 'label' => 'Note', 'rules' => '')

Am I missing some important concept with validation, or is this some kind of a bug?


Messages In This Thread
form_validation messes up the POST - by El Forum - 05-20-2009, 03:25 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 03:52 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 03:55 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 04:03 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 07:16 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 09:54 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 10:17 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 10:36 PM
form_validation messes up the POST - by El Forum - 05-20-2009, 10:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB