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

Display blank output when no computation was type

Explorer ,
Nov 06, 2023 Nov 06, 2023

Hello,  I am creating a form and here is the situation:

 

I am getting the product of textfield1 and textfiled2 and display output on textfield3, already done that and works using Calculate tab on a textfield option  'Value is the product (x) of the ff. fields'. 

 

My Question is how do I get to display blank output when no numbers are typed in the computation textfields? (I dont want '0.00' to appear when I type nothing on '1' and '2')

 

please refer to the picture for reference:

 

avv98_1-1699322501381.pngexpand image

 

TOPICS
Create PDFs , Edit and convert PDFs , How to , Modern Acrobat , PDF , PDF forms
1.2K
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
1 ACCEPTED SOLUTION
Community Expert ,
Nov 06, 2023 Nov 06, 2023

Use this as 'Validation' script under 'Validate' tab:

if(event.value == 0) event.value = "";

View solution in original post

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 ,
Nov 06, 2023 Nov 06, 2023

Use this as 'Validation' script under 'Validate' tab:

if(event.value == 0) event.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
Explorer ,
Nov 06, 2023 Nov 06, 2023

I tried that script but dont work

 

avv98_0-1699341765411.pngexpand image

 

the 0.00 is still there

 

avv98_1-1699341794162.pngexpand image

 

I used the calculate tab 'value is the product of the following fields'

 

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
Explorer ,
Nov 06, 2023 Nov 06, 2023

Although I found an article like this which you commented on:

https://community.adobe.com/t5/acrobat-discussions/how-to-display-blank-on-computed-field-instead-of...

 

which the solution was: (using custom calculation script)

var f1 = Number(this.getField("textfield1").valueAsString);
var f2 = Number(this.getField("textfield1").valueAsString);
if(f1&&f2)
event.value = f1/f2;
else
event.value = "";

 

thank you 

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 ,
Nov 06, 2023 Nov 06, 2023

Glad you found the solution, but my suggestion above work also, it's a validation script so to trigger it for first time, you need to change value of the field and then it will work.

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
Explorer ,
Nov 06, 2023 Nov 06, 2023

ohh ok, already tried it but I need to type '0' in textfield1 or 2 since it needs a product (x) for it to activate blank text field (next to the field with 3.00 is the field in which I used your given script)

 

avv98_0-1699343179772.pngexpand image

 

what I want is even there is no number input in the textfields the output textfield should be blank, and not showing '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
Explorer ,
Nov 07, 2023 Nov 07, 2023
LATEST

ohhh sorry you're right it worked. I had to type in numbers first for it to activate, but the script from you worked the first time.

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