Welcome Guest, Not a member yet? Register   Sign In
Callback doesn't work, what's wrong?
#1

[eluser]ReyPM[/eluser]
Hi, I've this code in my template:
Code:
<label>Código UNESCO:</label>&lt;?php echo form_error('unescocode'); ?&gt;
     &lt;?php if ($arrayUnescocodes): ?&gt;
         <select id="id_unesco" name="id_unesco">
      <option value="0">Seleccione un valor ...</option>
      &lt;?php foreach ($arrayUnescocodes as $clave => $valor): ?&gt;
   <option value="&lt;?php echo $clave; ?&gt;">&lt;?php echo $valor; ?&gt;</option>
      &lt;?php endforeach; ?&gt;
         </select>

And this other code in my controller:
Code:
$this->load->library('form_validation');
$this->form_validation->set_rules('id_unesco', 'Código UNESCO', 'trim|xss_clean|callback_check_unesco');

public function check_unesco($value) {
if ($value == 0) {
     $this->form_validation->set_message('check_unesco_value', 'Debe seleccionar un Código UNESCO');
     return FALSE;
} else {
     return TRUE;
}
    }

When I send the form and leave id_unesco as 0 non error is displayed and form is send, why? where I´m wrong?


Messages In This Thread
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 09:40 AM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 10:27 AM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 12:25 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 12:50 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:27 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:29 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:31 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:37 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:39 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:40 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:45 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:48 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 01:52 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 02:01 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 02:25 PM
Callback doesn't work, what's wrong? - by El Forum - 11-19-2012, 02:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB