Skip to main content
Known Participant
March 26, 2019
Answered

script check

  • March 26, 2019
  • 1 reply
  • 1259 views

I have been using this script below to select Yes or No to populate text fields. It also works in other ways as well. Well, now I would like to include a tax field using the same script but what it's doing is, it's adding the "1", "2" or "3" inside of the tax rate field. See the script to better understand.

Script:

if (event.value.toUpperCase()=="1") event.value = ".08";

if (event.value.toUpperCase()=="2") event.value = ".095";

if (event.value.toUpperCase()=="3") event.value = ".10";

What can I do or modify to have the value be entered into the tax rate field as the tax not the "1", "2" or "3"? It's probably very simple but it's beyond me. Can someone please help me out? Thanks.

This topic has been closed for replies.
Correct answer try67

Use it as a custom calculation or validation script, instead.

1 reply

try67
Community Expert
Community Expert
March 26, 2019

So you want the user to be able to enter "1" and have it automatically convert to ".08", for example?

If so, your code should work (although you don't need the toUpperCase() part...). Where did you place it?

pdfUser1Author
Known Participant
March 26, 2019

Heya Gilad,

I placed the script in the Custom Format. Although, I've tried it in some other places too. You are correct, it does work. It shows the tax rate decimal but it multiplies the "1", "2" or "3" by the Total. Not the tax rate (ex. .0975 etc). I'm a bit confused and don't know what to try.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 26, 2019

Use it as a custom calculation or validation script, instead.