Welcome Guest, Not a member yet? Register   Sign In
Problem with setting a default zero in form validation rule
#7

[eluser]tpetrone[/eluser]
I don't think you should be using the validation functions as a way to "set" data if a NULL condition is detected.

Validation is just testing the current values against a set of rules..

If you need to modify the $_POST/$this->input->post data, either do it before you validate or after you validate.

IF your going to use a callback in your validation then the callback should probably return either a TRUE/FALSE response.


Code:
function validateValue($value){

  if(empty($value) || is_null($value)){
  
    $this->form_validation->set_message('some_value', 'This field cannot be empty');
     return(FALSE);  // The value is NULL

   }else{

     return(TRUE);
  
   }


}


Messages In This Thread
Problem with setting a default zero in form validation rule - by El Forum - 11-21-2012, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB