Welcome Guest, Not a member yet? Register   Sign In
validation problem
#4

[eluser]Clooner[/eluser]
[quote author="alberta" date="1249821157"]sorry, i had put wrong view page.. i've also used form_validation, but still not showing error message Sad[/quote]

It seems that you mess up the order somehow.

It should look like something like this In your controller
Code:
function edit_plan($plan_id)
{
  $this->load->library("form_validation");
  $fields=array(array('field' => 'commit',
                    'rules' => 'trim|required'));
  $this->form_validation->set_rules($fields);
  if ($this->form_validation->run())
  {
     // in case of success
     // do your thing
     // redirect to someplace
  } else
  {
    // in case of failure
    // actually you don't have to do anything here
  }
  //show the view file of the form including the error message here
}
And in your view
Code:
<?php echo form_error('commit'); ?>
<form name="editplan" action="  <?php /* same url as before */ ?>   " method="post"  >
<textarea class="text"  cols="48" name="commit" style="height: 100px;" ><?php echo set_value('commit'); ?></textarea
<input value="Commit"  type="button">
</form>

again use the form_validation library. It is a bad idea to use the validation library. Make sure you do everything in the correct order. The manual is very clear on how to use the form_validation library.


Messages In This Thread
validation problem - by El Forum - 08-08-2009, 11:41 AM
validation problem - by El Forum - 08-08-2009, 12:50 PM
validation problem - by El Forum - 08-09-2009, 01:32 AM
validation problem - by El Forum - 08-09-2009, 03:10 AM
validation problem - by El Forum - 08-14-2009, 03:35 AM
validation problem - by El Forum - 08-14-2009, 05:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB