Skip to main content
Known Participant
November 7, 2023
解決済み

Display blank output when no computation was type

  • November 7, 2023
  • 返信数 1.
  • 1390 ビュー

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:

 

 

このトピックへの返信は締め切られました。
解決に役立った回答 Nesa Nurani

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

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

返信数 1

Nesa Nurani
Community Expert
Nesa NuraniCommunity Expert解決!
Community Expert
November 7, 2023

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

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

avv98作成者
Known Participant
November 7, 2023

I tried that script but dont work

 

 

the 0.00 is still there

 

 

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

 

avv98作成者
Known Participant
November 7, 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-zero/td-p/13613408

 

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