Skip to main content
trinises93590410
Participant
March 18, 2017
Question

How do you writh a javascript for percentage of discount mutiply by quantity and cost.

  • March 18, 2017
  • 3 replies
  • 636 views

How do I calculate the quantity (2) by the cost ($10) and (discount)?  For example, (2*$10.00)*(1-15%)

This topic has been closed for replies.

3 replies

trinises93590410
Participant
March 18, 2017

Is there a way to get the "Discount" to show as a percentage when a number is entered without needing to enter a decimal before the number?  For example, 15 is entered but 1500% displays instead of 15%

try67
Community Expert
Community Expert
March 18, 2017

As I said, this would require using custom Format and Keystroke scripts... For the Format script you can use this:

if (event.value) event.value += "%";

And for the Keystroke you can use this:

event.rc = !isNaN(AFMergeChange(event));

trinises93590410
Participant
March 20, 2017

Thank you so much for all your assistance.  The form is complete.  You are awesome!  Have a wonderful and blessed week!

trinises93590410
Participant
March 18, 2017

Quantity

Cost

Discount

Total Cost

try67
Community Expert
Community Expert
March 18, 2017

Is the Discount field a percentage field, or a number field?

trinises93590410
Participant
March 18, 2017

I have attached the form for you to review. I would like to be able to enter 15 in the discount column and it convert to 15%. I would like for the “Total Cost” column to calculate the “Quantity” * “Cost for 1” * “Discount”.

try67
Community Expert
Community Expert
March 18, 2017

What are the names of the fields involved?