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

Value entered does not match the format of the field - Button event

Guest
Dec 08, 2016 Dec 08, 2016

I'm trying to write a script which allows the user to click a button which will perform a calculation and fill in the "CompletedValue" field with the results. The script I've written currently looks like this:

var cV = this.getField("CompletedValue").value;

var pV = this.getField("PresentValue").value;

if (cV.value!='' || cV.value!=null)

{

getField("CompletedValue").value="";

var X = Math.ceil((pV*(100/75))/100)*100;

this.getField("CompletedValue").value = X.ToString;

}

else

{

var X = Math.ceil((pV*(100/75))/100)*100;

this.getField("CompletedValue").value = X.ToString;

}

When I click the button, however, I am getting the error messages "The value entered does not match the format of the field [ CompletedValue ]".

The CompletedValue field is currently formatted to Numbers, 0 decimals & no currency symbol. If I change the format to None, I do not get the error, but the value that shows in my field is 'undefined'.

I've alternatively tried to write (what I believe is) the problem line like this:

this.getField("CompletedValue").value = intParse("X").ToString;

& like this:

this.getField("CompletedValue").value = X.valueAsNumber;

But all of my attempts have resulted in either the error message or the 'undefined' string output. Ideally I would like to keep the CompletedValue field formatted for Numbers, but if it has to have no formatting I can live with that. Any ideas how to resolve this?

TOPICS
Acrobat SDK and JavaScript , Windows
423
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

correct answers 1 Correct answer

Community Expert , Dec 08, 2016 Dec 08, 2016

You don't need any of that. Just use this:

this.getField("CompletedValue").value = X;

Translate
Community Expert ,
Dec 08, 2016 Dec 08, 2016
LATEST

You don't need any of that. Just use this:

this.getField("CompletedValue").value = X;

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