views:

55

answers:

3

I have a number of input fields that accept numbers. When the calculate button is pressed, the calculations are sent to a number of other input fields with the results. I then have to go and click each of the result fields to format the contents. I would like to be able to attach code to the calculation button, in order to format all the input result fields at the same time. Is this possible?

A: 

Sure, it's possible. You just need to format the results properly before setting the values of the relevant fields.

Unfortunately, unless you can be more specific about your requirements, I can't give you a more specific answer.

Syntactic
A: 

I cannot format the results properly before setting the values because they will then have commas in the field and the calcualtion will not work. Formatting is done after the calculations and I click each field which is then formatted eg $12,265.00 I would like a function to add it to the Calculation Button

harry
If you have further information needed to make your question clear, please edit your question. If you are adding it in response to an answer, mention that as a comment to the answer. Don't *answer* a question with more information about the question.
David Dorward
A: 

Try creating a format function that gets called when each of the fields you want formatted change (using onchange on them). Then just carry out your calculation as before.

You might have to manually trigger the onchange right after setting the calculated value for each input field in order for the format function to run. I haven't tested this.

DaveS