CodeIgniter Forums
Rule Reference for greater_than/less_than value checking with using callback - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Rule Reference for greater_than/less_than value checking with using callback (/thread-68195.html)



Rule Reference for greater_than/less_than value checking with using callback - nkhan - 06-07-2017

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'
                                                                      ),
                      ),



    );



RE: Rule Reference for greater_than/less_than value checking with using callback - kilishan - 06-11-2017

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