The value entered does not match the format of the field

New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Please help! I am fairly new with using adobe and creating javascript equations. I have run into the error that many new user have, the dreaded "The value entered does not match the format of the field" pop-up. This only occurs when the value answer is 0... 

I am creating a till balance form for a retail company, so having that 0 value show is important and fairly frequent, as you want the till to show 0 variance. 

Indi5FC6_0-1616531705708.png

Here are the columns Cash(Counted) = AMCash
Cash on Shift Report = AMPOSCash 

For the Cash +/- I have a Simplified Field Notation set as AMCash-AMPOSCash 
The format is Number to the second decimal point, which I need since we are talking money.
It does the math just fine, but I meet an error when the total is 0 for that column. 

I have spent so long on trying to get this to function properly. Please help me if you can!!! Thank you! 

TOPICS
Create PDFs, Edit and convert PDFs, General troubleshooting, JavaScript, PDF forms

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Mar 25, 2021 Mar 25, 2021
OK, now that you've (finally) provided a concrete example I was able to reproduce it. This is happening due to a rounding issue. The value of "AMCash" is not really 91.58, but 91.58000000000001. And when you subtract 91.58 from that you get this value in "AM Cash Variance": 1.4210854715202004e-14 This value can't be shown by the Number format, which causes the error. You would have seen all of this if you had just removed the Number format from your fields. Anyway, the solution is to round the r...

Likes

Translate

Translate
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

This should not be happening. Can you share the file with us?

What exact values are you entering into both fields?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Thanks for willing to help me!

The cash(counted) column adds up the total of another portion of the form. The cash on shift report column is cash sales for the day, so the values input always vary, but should match.

For example:
Cash(Counted) $372.45 - Cash on Shift Report, $372.45 = 0.00

Here is the form. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Also, the cash(counted) column equation works well, so I just want to express that this is not the issue. I am running into this error multiple times on this form, but only when an equations answer is 0.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

This usually happens when you try to divide by zero, but you're saying you're only subtracting, which should not be a problem... So please share the file so we could look into it in more depth.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I shared it up above in my initial reply. 🙂 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Sorry, didn't see it. I'm not getting the error message you described, but I am getting others.

They are most likely caused because you renamed or removed a field after having selected it for a calculation, or because you used a field name which causes issues. I would recommend avoiding names which are just numbers and special characters, like "+" and "-" in the field names, since they can be confused with those mathematical operators. Try solving these issues and then try it again.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

It doesn't seem to do it when you are in the preview mode- if you save and input info regularly, it'll give you that error. 
I just took away the + and - to try and see if that would help, but still running into my error. 

IndiErst_0-1616539906441.png

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

This doesn't make sense. That field doesn't have a calculated value at all...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

The calculated value is the Cash(Counted) - Cash on Shift Report... it's the calculated subtraction.. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I don't see it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

IndiErst_0-1616542264044.png


It's this highlighted box...

IndiErst_1-1616542305907.png

 here is the calculation... 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I can't see this fields in the PDF document.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

It's the renamed "AM Cash +/-". However, the calculation still doesn't appear for me in the original file.

Did you at some point edit the code via Edit All JavaScripts? That can cause serious damage to the file.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

No, I have only been editing one at a time. There is no reason for me to edit all javascript. Don't know why the calculation isn't appearing for you, I'll reattach. 


Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

I've seen people give formulas like the below to solve the issue....

var Volume = this.getField("Volume").value;
var Hours = this.getField("Hours").value;
var Maximum = this.getField("Maximum").value;

if (Volume.valueAsString !=""){event.value = Volume/Hours/Maximum}
if (Hours.valueAsString !="")
{event.value = Volume/Hours/Maximum}
if (Maximum.valueAsString !="") {event.value = Volume/Hours/Maximum}

event.value = Volume/Hours/Maximum;

 

but I truly don't understand these and need some help... 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

How is this related to your original question?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

It's related because I've seen formulas like this example in other threads to fix the issue I am having. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Well yes, you can use a script to do it. That will allow for much greater flexibility and you could use any field name you'd like...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Yep. I'm aware you can use a script to do it, I am just saying I've seen this for the fix, but don't know how to make it work for my form. As I stated, I was just showing an example of how others have fixed the issue as this is a common adobe error.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Again, I don't believe this calculation is causing that error, and you haven't shown that it does so far, but if you want to use a script to subtract one value from another it's easy:

 

var v1 = Number(this.getField("AMCash").valueAsString);

var v2 = Number(this.getField("AMPOSCash").valueAsString);

event.value = v1-v2;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

The calculation only causes an error when the result is 0. I've done my best to provide screenshots and be as detailed as I can to show what issues I am running into. The entire form worked perfectly until I input the calculation- the pop-up is also stating that it is coming from that field in particular... I don't see how it can be coming from somewhere else. 

Thank you for that script, though. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Is there something I can add to the end of this script that allows me to have a 0 value - does that make sense? I input this, and am still getting the error message when the calculation value is 0... I think the 0 is the issue. 

IndiErst_0-1616606691047.png

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

This script makes no sense.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

It's just an example of what I've seen people in other threads come up with as a solution for the same problem, this is obviously not fitting for my form as it's an example from someone else's. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines