Welcome Guest, Not a member yet? Register   Sign In
custom form validation
#2

[eluser]CroNiX[/eluser]
You can pass it in as the optional second parameter using the square brackets.

Code:
public function count_records($fieldvalue, $uid)
{
  $q = $this->db->query("SELECT * FROM mytable WHERE userid = ".$uid );
  $c = $q->num_rows();
  
  if ($c > 19)
   return false;
  else
   return true;
  
}
Then you would:
Code:
$this->form_validation->set_rules('mycheckbox','My Checkbox','callback_count_records[14]');  //14 is uid

Or, you could just create a hidden field on your form with the uid and in your count_records() validation function, you can retrieve it via $input::post('uid').


Messages In This Thread
custom form validation - by El Forum - 07-11-2012, 09:08 AM
custom form validation - by El Forum - 07-11-2012, 10:01 AM
custom form validation - by El Forum - 07-12-2012, 08:02 AM
custom form validation - by El Forum - 07-12-2012, 09:30 AM
custom form validation - by El Forum - 07-12-2012, 11:16 AM
custom form validation - by El Forum - 07-12-2012, 11:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB