null value and functions

null value and functions

So I have 3 fields that are all tied together to generate a total $ amount due. Orginization type, NumChairs, and NumTables. I have an On User Input action that looks like this for each of the 3 fields on the form:

input.Amount_Due = thisapp.scpride.getAmount(input.Organization_Type, input.Number_Of_Chairs, input.Number_Of_Tables);

getAmount is a function that gets a $ amount from a different table, and then calculates what the total price should be depending on the input of those 3 fields, something like this:
orgAmount = thisapp.scpride.getDollarAmountFromType(input.organizationType);
Amount_Due = (input.NumChairs * 5 + input.NumTables * 15 + orgAmount);
return Amount_Due;

Nothing serious here, and it all works GREAT, except when any one of the 3 values are 'null'. I know I can do the checking within each user Input, but it's really bad code design to put that there, really the function should do the checking (but doing that doesn't work).

So I guess I'm saying, is there a way to do this checking in the function? Instead of having each input field action check it's neighbors before running the function?

With Love,
Tara
birltara