I want run JavaScript check function, here is my code:

```
<script>
    function check(){
        var all_problem = parseInt(document.getElementById('all_problem').value);
        var problem_one = parseInt(document.getElementById('problem_one').value);
        var problem_two = parseInt(document.getElementById('problem_two').value);

        var join_problem = problem_one+problem_two;
        if (all_problem<join_problem){
            //submit button is not permit to upload data
        } else {
            // submit button permit to upload data
        }
    }
</script>

```

And here is my submit button function:

```
<?php
    echo CHtml::submitButton($model->isNewRecord ? 'Simpan' : 'Simpan', array('name'=>'save'));
?>

```

My scenario is: if all problems 5, and join problems is 6 (all problems < join problems), action on submit button won't run. and if all problems 5 and join problems 4 (all problems > join problem), action submit button will run.