0

I have a function to call multiple fields in Joget Workflow. But sometimes the inverse function is invoked. If (pakai) is less than the (kuota) field shown correctly that is (pakai), but if (pakai) larger than the (kuota) of result displayed still (pakai), should be called (kuota).

<script type="text/javascript">
    function calculation() {
        var kuota = $('[class^=calFiel][name=totalkuota_bbm_unformat]').val();
        var pakai = $('[class^=calFiel][name=totalpakai_bbm_unformat]').val();
        if (parseFloat(pakai) < parseFloat(kuota)) {
            $('[class^=calFiel][name=total_payable_bbm_uf]').val(pakai);
        } else {
            $('[class^=calFiel][name=total_payable_bbm_uf]').val(kuota);
        }
        $('[class^=calFiel][name=total_payable_bbm_uf]').trigger('keyup');
    }
    $(document).ready(function() {
        $('[class^=calFiel][name=totalkuota_bbm_unformat]').on('keyup', function() {
            calculation();
        });
        $('[class^=calFiel][name=totalpakai_bbm_unformat]').on('keyup', function() {
            calculation();
        });
    });
</script>
4

0 回答 0