You are viewing limited content. For full access, please sign in.

Question

Question

How do I get one field to subtract from another in forms 9.1?

asked on March 10, 2014

I can make the fields add together correctly, but now I need to be able to subtract.

 

Example, I have a standard sales goal of $300 per order.  When evaluating the performance of a sales associate against their goal I'd like their actual results to subtract from their goal.  how can i do this?

 

 

 

0 0

Answers

APPROVED ANSWER
replied on March 10, 2014 Show version history

If you look at the following example in the Forms Help file it talks about adding fields together. You would use the same process to subtract as well. I belive that you would just change the following line

s += parseNumber($(this).val());

so it is -= instead of +=.

1 0
replied on March 10, 2014

Thanks Blake, it works.  Appreciate the help.

0 0
replied on March 10, 2014

Can you mark his answer as correct? Thank you Lynda. :)

0 0
replied on March 19, 2014

How would one restrict the result with the example given in the Help documentation to 2 decimals?

0 0
SELECTED ANSWER
replied on March 19, 2014

If you're putting the value in a total field, your code would look like this, using the .toFixed:

 

$('.total input').val((sum).toFixed(2));


 

0 0
replied on March 19, 2014

Wonderful!

0 0
SELECTED ANSWER
replied on March 19, 2014

If you're putting the value in a total field, your code would look like this, using the .toFixed:

 

$('.total input').val((sum).toFixed(2));


 

0 0

Replies

replied on March 10, 2014

What method are you using currently to add your fields together?

 

If you are using JavaScript, then you can accomplish subtraction with a simple change to the script.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.