Highlighted

CALCULATING FORMS

New Here ,
Sep 24, 2020

Copy link to clipboard

Copied

Two questions, I have created a form that calulates.  all is well and working great.  However I would like for the cells with no activity to display nothing at all.  Is there a way to only displaty the calculation when the cells refferenced have data in them?  The attached example shows a lot of cells with $0.00 in them.  I also would like to not have the blue or any other color to display in the form either during editing or not. Is it possible to display all the baby blue color to white.

TOPICS
How to, PDF forms

Views

176

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

CALCULATING FORMS

New Here ,
Sep 24, 2020

Copy link to clipboard

Copied

Two questions, I have created a form that calulates.  all is well and working great.  However I would like for the cells with no activity to display nothing at all.  Is there a way to only displaty the calculation when the cells refferenced have data in them?  The attached example shows a lot of cells with $0.00 in them.  I also would like to not have the blue or any other color to display in the form either during editing or not. Is it possible to display all the baby blue color to white.

TOPICS
How to, PDF forms

Views

177

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 24, 2020 0
Engaged ,
Sep 24, 2020

Copy link to clipboard

Copied

As custom calculation script you could use something like this:
var cal = this.getField("Text1").value;
event.value = cal == "" ? "" : cal;
and for blue fields go to -> Edits -> Preferences -> Forms and tick off "Show border hover color for fields"

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 24, 2020 0
Most Valuable Participant ,
Sep 25, 2020

Copy link to clipboard

Copied

The conditional is not necessary there... You're copying the field's value either way. I think what they're after is more something like this:

 

var cal = Number(this.getField("Text1").valueAsString);
event.value = (cal == 0) ? "" : cal;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Explorer ,
Sep 25, 2020

Copy link to clipboard

Copied

Hi try67,  I have couple of questions.

What is the diff between yours and Nesa's second line of code? they look almost the same to me except 0 and Parentheses.

When to use Number and AsString? Does that mean to get value as number and export it as string?

Sorry for the questions, I'm trying to learn from you guys and girls 🙂

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Most Valuable Participant ,
Sep 25, 2020

Copy link to clipboard

Copied

My code will not show zero, but a blank value. Their's will show it as a zero.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Engaged ,
Sep 25, 2020

Copy link to clipboard

Copied

If Text1 value is 0 calculated field will be blank. Is there any specific situation where 0 will be shown with my code?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

Why does you check the value of field "Text1" ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Contributor ,
Sep 25, 2020

Copy link to clipboard

Copied

Both code works cuz 0 == false or false == 0 unless used in if condition, it's not necessary to check for 0 cuz
there won't be 0 in Text1 field.
OP only wants to hide 0 in event field.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
try67 LATEST
Most Valuable Participant ,
Sep 25, 2020

Copy link to clipboard

Copied

It has nothing to do with true/false. The issue is that you don't know the type of value returned by the field.

If the value is 0 (a number) then it will work, yes, but if it's "0" (a string), it won't.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

A simple way is to use a custom validation script, like the following:

 

 

// Custom validation script for calculated field
if (+event.value === 0) event.value = "";

 

 

This way, you can still use one of the built-in calculation options and not a custom calculate script.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

Also, the blue color is the field highlight color. A user has the option to turn off field highlighting, so that the background field color is visible. It's also possible to turn it off with a script, but you should reset the preference to whatever it was when the form is closed.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0