Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

"The value entered does not match the format of field" issue in regards to calculated values

Community Beginner ,
Jun 14, 2021 Jun 14, 2021

Sorry to be lengthy. I am also attaching the file I am  working on. I am doing incremental saves so I can go back to what worked or not. I will not touch this one for a while as I am asking for help and this is where I stopped.

Note: I am also on Acrobat 9. Long story short, employer refusing to provide documentation that can allow me to purchase the educational priced latest version.

 

I’m getting the dreaded “The value entered does not match the format of field [ Balance 4 ]”

Some things generate the issue for Balance3. These things do not use the Balance4(they don’t go that far)

 

If I share the PDF, the issues are on Page 8, where I have also consolidated all my fields for testing in one convenient area so I don’t have to go back and forth. There are elements in the white space at the bottom of the page, all of which will be removed from the final document.

 

Balance 4 is a final calculation that pulls information from all over the place. I am adjusting an existing PDF form, but we didn’t do certain things before, and now we have to. I have adjusted calculation orders as that has resolved a good many problems. I also feel that the calculations are correct because at every step, I am seeing correct numbers, which is confirmed via an Excel spreadsheet that I am using as my safety check. I can manipulate the numbers in the Excel file and see how they line up in the PDF. Also, before I started manipulating this PDF, everything was working. Also, I have had to change the calculation order around because this was a problem for a bit. Anything that is important as far as calculations are concerned has been moved to the end of this area. Most of the “calculations” are really just “copy down from this area”, and it is text. I mostly did that because I didn’t want to COPY fields, I wanted them to be read only and/or also do some basic adjusting for formatting so it looks nice when printed.

Page 1 is just an informational collection page. When this was added to the original form, no issues came up. This is used to populate certain fields and generate the two final pages that are given to me for data entry.
As far as Page 2, the only notable things are the Program selection and Full/Part time, which are carried down to Page 3 and can be selected/adjusted from there as well. I am considering moving these items  also to Page 1 for convenience. ON Page 3, we do have a few fields that need to be populated or adjusted, but the only one notable for this is the transfer hours/”Number of clock hours accepted as transfer/re-entry”. This field is important.

Skipping to the top of Page 8, we have two check boxes, which are important to this scenario. While the values next to these check boxes does not change, the check boxes adjust another set of boxes that are used for calculations..

I will focus on Page 8. Starting from the top area, the “starting balance” calculation is confirmed correct and when it comes to things being calculated on the page, this is the first item. It gets its numbers from the addition of 3 locations I think on Page 3. All page 3 calculations are correct.

Then there is a visible but non-printing “adjusted rate” calculation, with a green outline. Green outlines means “this is a value I am generating and will use in other calculations and will be marked as hidden when I am done”.

 

When I skip down just a tiny bit, I see 4 fields: Hours 1-4. These fields are being populated by the document javascript for populating those fields. This is correct, text only, no calculations.

The next line is “PlannedPayment1-4”, and all those values are correct and are calculated.

The next line is “Balance 1-4”, where Balance3 and Balance4 generate issues. 2 programs have an issue with Balance3 because they don’t use Balance 4. 2 programs have issue with Balance4 because they use Balance 4. For those that end on Balance3, the value for Balance 3 should be a zero and the calculation shows that. For those that end on Balance4, the value for Balance 4 should be a zero and the calculation shows that. I am convinced the calculations are correct so I am puzzled as to why there is this issue.

The white space at the bottom is being used as a temporary work space for troubleshooting. I can remove all these fields here and the problems still exist. There is a pull-down menu that allows the programs to be selected. This is a copy placed here for convenience. There are two check boxes, which are defaulted as unchecked, and make the box next to it either a value or zero. These are the same check boxes on the top of Page 7. I did things this way because it made the most sense to use the box values for calculations. Checking and unchecking these checkboxes generates the error as well. I’m open to a better way of doing it. There is also a field where the value can be changed. I won’t go into all the details but let’s just say for my testing purposes, the calculations are adjusted based on this number being changed and the calculations are coming out correct. The Javascript for the document set-up is pushing a a value of “0” into this field whenever a program is changed and I added a validation script to ensure a zero is populated if the field is blanked. This is intentional because if someone changes programs, I want to start “fresh” for that program. I also added my document reset button for convenience. I have an issue with people using the form and NOT clearing it out so the reset is necessary.

Setting the format Balance 3 and 4 to text makes the error go away but then I lose the formatting I would like to use.

The Java console is not generating any errors.

Thank you in advance for pointing out all the things I am doing wrong. This is a big learning curve for me.

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , How to , JavaScript , PDF forms
15.5K
Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

Hi,
I didn't check everything, but if you write for example:
var v1 = Number(this.getField("Balance3").valueAsString);
the v1 variable is a number, so then you can't write:
if (v1 == "0")
but
if (v1 == 0)
Already try with this modification for all fields with this kind of script!
@+

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

I'm too tired to go over that this right now, but I now have a starting point. I am using the "0" all over the place so I will start with the Balance 1 through Balance 4 fields first, check and then start working outwards from there.

TO help me understand, what is the difference between == "0" and just the == 0? I think, based on what you said, "0" has to be ZERO(or exactly), where-as  the 0 can be a variable?

Again, thank you. Will dive into this after sleeping and will hopefully have learned something new and have good results.

Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

"0" is the character (48 ascii code)

and

0 is the zero number

Besides, if the format of the field is "Number", you don't need to write:
var v1 = Number(this.getField("Balance3").valueAsString);
but only:
var v1 = this.getField("Balance3").value;
@+

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

I went ahead and started with your suggestion. While it didn't seem to help, it did not make the problem worse. Based on your follow-up answer to my question, it was clear that these changes had to be made as you suggested and I went ahead and made all those changes. I even went through the document and anywhere there was a number and I was using the "0", I changed it to just 0.

 

The problem still exists. I am wondering if there is a problem with the set-up script, at least involving values that will be used for calculations. For example:

"Barbering Course":{ CourseName: "Barbering Course",
PayPeriod1: "450",
PayPeriod2: "450",
PayPeriod3: "300",
PayPeriod4: "300",
Hours1: "1-450 Hours",
Hours2: "451-900 Hours",
Hours3: "901-1200 Hours",
Hours4: "1201-1500 Hours",
AppFee: "100",
STRF: "0.0005",
TransferHours: "0",
TotalClockHours: "1500",
AbsentHours: "265.5",
AdditionalTrainingRate: "12",
MonthlyPayments: "N/A",
MonthlyPaymentAmount: "N/A",
FirstMonth: "N/A",
FirstMonthAmount: "N/A",
LateCharge: "50",
SecurityInterest: "100",
Tuition: "13000",
Books: "300",
KitFees: "2200", },

 

Just to keep things quick, I know I use the tuition number as a number used for calculations, as well as TotalClockHours, STRF, AppFee and others. Books and KitFees are either the number shown or zero. I'm still investigating some of my calculations. I am wondering if in the set-up stuff as in the example above, should I remove the quotations from the numbers? I'm going to experiment with that a bit after I do more checking of calculations as I feel I may have overlooked a couple of things. Aside from those elements so far, I'm just not sure where else to look.

I feel I've made some positive forward progress, it just isn't showing itself yet.

Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

Yes, you can try to remove the quotations for numbers.

and what's about the "N/A" values? When are they used???

i will have a look on your file later this evening...

@+

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

I haven't removed the quotes yet but I am going to shortly.

The N/A values are merely used to populate fields and serve as placeholders for something that may change in the future. Those are used on Page 4. There are no calculation, it's just basically "filling the blanks". There used to be an in-house financing option, but that's no longer being utilized, but we're now lookin at bringing that back.

 

Also, I am questioning things like this from what I have done previously:

var f1 = Number(this.getField("TuitionCalculated").valueAsString);

 

My reading and interpretation leads me to think I should change it to this:

var f1 = Number(this.getField("TuitionCalculated").value);

 

I went ahead and made those changes but there's no difference. I do know anything I do, I have saves that I can go back to for recovery/fail-back purposes. I'vecertainly done that plenty of time already, including starting over from the current in-production form.

I will make some changes and perhaps upload a newer file sometime today or this evening.

 

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

I was unable to remove the quotes from the set-up Javescript. I was getting errors on every line so it looks like those can't be changed. That's OK, it's learning.

Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

Change the format of the fields to "None" and you can see what you get.

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Regarding changing the format of the fields to none, the following was observed:

Let me just set a procedural thing I am doing for testing: I click the form reset button before changing programs. Normal operations, I cannot assume they will do that and I fully expect they won't. I know if I was using it for production I sure wouldn't click reset every time.

 

OK, I changed the Balance3 and Balance4 to "none" for formatting. The error vanishes.

For Barber, the last value is 9.094947017729282e-13(Balance 4)
I changed Balance3 to "none" for formatting because it was also generating the same error: "The value entered doe not match the format of field [ Balance3 ]". Problem cleared.

 

I tried this in the past and got the same result. I think I may have mentioned it previously but I'm not concerned about that. It's easier to ask the question and get an answer. It's more efficient sometimes.

Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

You should read this:

https://www.pdfscripting.com/public/Value-Entered-Does-Not-Match-Format.cfm?sd=40


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Very helpful and got me most of the way there. I also had to do some adjustments and it helped get that dollar sign back. The other errors are cleared. I have made the changes to the Balance 3 and 4 fields. Now I am trying to figure out how to have those fields be blank when there is no value in the payment field above them. Trying some stuff with poor results but I gotta struggle a bit. I know I'll need help. I'll share in a bit once I get frustrated.

 

Translate
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
Community Expert ,
Jun 15, 2021 Jun 15, 2021

You could hide the fields if the value is 0:
if (event.value==0) event.target.display=display.hidden;
else event.target.display=display.visible;

@+

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

That's what I'm trying to figure out.

 

The thing is, a calculation of zero is acceptable and I don't want that hidden. If the "Payment4" field is blank or zero, Payment 4 should be hidden, which it is. That part seems OK. If Payment4 has a zero or no value or blnk, then Balance4 should be blank.

Right now I am dealing with Balance4 vanishing if I click the kit/book decline buttons or populate the TranferHours field. This is making me start to question the calculations. I'll post where I am at shortly before I head out for the day.

Right now I'm just not sure where to put this:

if (event.value==0) event.target.display=display.hidden;
else event.target.display=display.visible;

 

I'm assuming using it as a validation script.

 

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Just adding the file. I got to walk away from it a while and do somthing else.

 

Mostly working. There are inconsistencies between Balance 3 and 4 but that is intentional as I've done different things.

Problems: When barber is selected, things are fine. Checking the check boxes or putting anything into  transfer hours causes Balance 4 to vanish.

Cosmo, Balance 4 never shows up.

Esthetics and Nails, the problem transfers to Balance3 as is like Cosmo Balance4.

Translate
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
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Latest changes.
Balance 3 and 4 always showing, which should not be the case when in the "Null/Default". Balance 4 should not shown when Payment is not shown due to a zero value.

It's close. I know it's still stuff beyond what I am capable of right now.

Translate
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
Community Expert ,
Jun 16, 2021 Jun 16, 2021

That comes from the Custom Format Scripts of your Balance3 and Balance4 fields:
if((event.value == 0) || isNaN(event.value) || (event.value== Infinity))
event.value = "$0.00";
else
event.value = "$" + util.printf("%,0.2f", event.value);

You must remove $0.00 if you want nothing appears.
@+

Translate
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
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

I played with that and I had removed it, then I re-added it.

What I am after is "if Payment 3 has a value(any value), then Balance 3 must have a number, which could be a zero. This would show the program was paid off and has a zero balance for programs using 3 pay periods". Repeat for Payment 4 and Balance 4. When NULL program is selected, all fields are blank.

Thanks. You did confirm something that was causing me some problems. At the moment, I am going to try to make Payments 1-4 round to 2 decimal places. I think this will help with some of the calculations and some of the results.

Translate
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
Community Expert ,
Jun 16, 2021 Jun 16, 2021

I didn't deeply study all the scripts of your document, but I think you have too much scripts for both of these fields:
A custom format scripts, a custom keystroke script, a validation script and a calculation script.
Check if all are really needed.
@+

Translate
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
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Part of what is in there is due to having to troubleshoot using what information I can gather. Anything that is deemed not necessary can go.

I was recommended here to use a custom format script, which by using that has stopped the original problems. I think this one is necessary.

The validation script may or may not be needed and can easily be removed.

I'm not sure if the keystroke script was needed. I know that somethink broke from the custom formatting script and the keystroke script seemed to bring things back. I am OK with removing it.

I'm pretty sure that the calculation script is necessary since I need to do calculations.

I will start with removing the validation script.  I know this will do no harm. I will also remove the keystroke script. I'm alway in favor of minimalization and being as simple as necessary.

Translate
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
Community Expert ,
Jun 16, 2021 Jun 16, 2021

You can remove the custom keystroke script and the validation script.

@+

Translate
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
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Done.

 

The issue now is I can't figure out how to have Balance3 show a zero if Payment3 is populated and Balance3 rounds to a zero, at least for the 3 programs that stop at Payment3/Balance 3.

The same issue exists for Payment4/Balance4.

 

What happens is when I do the kit/book or transfer hours, the number vanishes. I  think this is why I tried the validation script but it's not quite right.

Basically, if Payment3 or Payment4 show a value, Balance3 or Balance4 must show a value, even if the value is zero($0.00)

Translate
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
Community Expert ,
Jun 16, 2021 Jun 16, 2021

try:

...

if (v1==0 && v2!=0)

...

Translate
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
Community Beginner ,
Jun 17, 2021 Jun 17, 2021

Brain fried. Not sure where to place that. Sorry for being so stupid. Been doing other troubleshooting today: fix chairs, pick a lock because someone locked keys in a cabinet, train 6 people on some software, still gotta hang whiteboards and a wall-mount for a TV. Brain can't really get into this today. Plus lack of skill in this area preventing me from properly associating where to place this bit.

Thanks for breaking it down Barney-style if you can.

Translate
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
Community Expert ,
Jun 17, 2021 Jun 17, 2021

Your form is quite complex with a lot of fields and calculations.
If I have to study all the possibilities, that will take a long time.
Could you share a file with a bad result and indicate what it should be.
@+

Translate
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