CodeIgniter Forums

Full Version: Rule Reference for greater_than/less_than value checking with using callback
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there ny way to  greater_than/less_than  checking with using callback function in CI 3.0.

I have two fields about course fess. 

$one-time-pay=10,000

$instalment_pay =12,000


I want installment pay always will be greater than onetime payment.


Please help me.

Thanks



Code:
public $rules = array(
                       'name' => array(
                                        'field'  => 'name',
                                        'label'  => 'Course',
                                        'rules'  => 'trim|required',
                                        'errors' => array(
                    
                     'one_time_payment' => array(
                                        'field'  => 'one_time_payment',
                                        'label'  => 'Onetime Payment',
                                        'rules'  => 'trim|required|integer',
                                        'errors' => array(
                                                                          'required' =>"Please enter Onetime Pay Amount",
                                                                      ),
                     ),
                    'installment_payment' => array(
                                        'field'  => 'installment_payment',
                                        'label'  => 'Installment Payment',
                                        'rules'  => 'trim|required|greater_than[one_time_payment').']');,
                                        'errors' => array(
                                              'required' =>"Please enter Installment Amount",
                                             'greater_than'=>'Plase enter some greater value than Onetime payment'
                                                                      ),
                      ),



    );
You posted in CI4 forums, but this looks like CI3 code. Which version are you targeting?