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

[eluser]Michael Wales[/eluser]
My first thought, with a <select> input is... don't put -1 within the <option>s - but, just to answer your question.

Code:
function form() {
  $this->load->library('validation');
  $this->validation->set_rules(array(
    'selectbox' => 'required|callback__check_setbox'));
  $this->validation->set_fields(array(
    'selectbox' => 'Your select box'));
}

function _check_setbox($val) {
  if ((int) $val >= 0) {
    return TRUE;
  }
  $this->validation->set_message('_check_setbox', 'Your setbox must be greater than -1.');
  return FALSE;
}


Messages In This Thread
validation problem - by El Forum - 09-16-2008, 08:47 AM
validation problem - by El Forum - 09-16-2008, 09:12 AM
validation problem - by El Forum - 09-16-2008, 02:02 PM
validation problem - by El Forum - 09-16-2008, 02:52 PM
validation problem - by El Forum - 09-16-2008, 03:04 PM
validation problem - by El Forum - 09-16-2008, 09:10 PM
validation problem - by El Forum - 09-16-2008, 10:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB