I have two input field carrying Product Price and Product Strike Price. In which Product Strike Price can be zero but cannot be less than or equal to product price. I created a callback function but it does not work it throws error as 'Unable to access an error message corresponding to your field name Product Strike Price.(price_check)'
Here is Callback function:
function price_check(){
$pd_price = intval($this->input->post('product_price'));
$pd_strikeprice = intval($this->input->post('product_strike_price'));
if($pd_strike_price > $pd_price OR $pd_strike_price = 0){
return true;
}else{
$this->form_validation->set_message('price_check', 'Product Strike Price can be zero(0) but cannot be less than or equal to Product Price.');
return false;
}
}
And here is the Form validation:
$this->form_validation->set_rules('product_strike_price', 'Product Strike Price', 'trim|required|is_natural|callback_price_check');
Some one please help me in resolving the issue.