How to call a function from an OnLoad Client Script from an Onsubmit client script?

Not applicable

I need to be able to update the value of a field in an OnLoad Client Script. I am calling the function that updates the field from an OnSubmit Client Script but I am not sure that I am calling the function correctly. I leave the code that I am using:

Catalog Client Script OnSubmit:

function onSubmit() {

    var totalCost = 10;
    updateGrandTotal(totalCost);
}

 Catalog Client Script OnLoad:

function updateGrandTotal(totalCost) {


    g_form.setValue('grand_total', totalCost);


}

function onLoad() {

	

}