Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
Use this as 'Validation' script under 'Validate' tab:
if(event.value == 0) event.value = "";
Copy link to clipboard
Copied
Use this as 'Validation' script under 'Validate' tab:
if(event.value == 0) event.value = "";
Copy link to clipboard
Copied
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'
Copy link to clipboard
Copied
Although I found an article like this which you commented on:
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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)
what I want is even there is no number input in the textfields the output textfield should be blank, and not showing '0.00'
Copy link to clipboard
Copied
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.

