Highlighted

before statement

Engaged ,
Jul 27, 2020

Copy link to clipboard

Copied

I'm getting missing before statement, Do I need to separate +*  and how do I do it?

event.value = Number(this.getField("field").valueAsString)"+"+*6+"%";

 

TOPICS
Acrobat SDK and JavaScript

Views

62

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

before statement

Engaged ,
Jul 27, 2020

Copy link to clipboard

Copied

I'm getting missing before statement, Do I need to separate +*  and how do I do it?

event.value = Number(this.getField("field").valueAsString)"+"+*6+"%";

 

TOPICS
Acrobat SDK and JavaScript

Views

63

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
Jul 27, 2020 0
Most Valuable Participant ,
Jul 27, 2020

Copy link to clipboard

Copied

What are you trying to achieve, exactly?

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...
Jul 27, 2020 0
Engaged ,
Jul 29, 2020

Copy link to clipboard

Copied

Sry for late reply. I want value to show like this '+6%' but can't add + sign infront of *6 calculation.

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...
Jul 29, 2020 0
Adobe Community Professional ,
Jul 29, 2020

Copy link to clipboard

Copied

Want you display '+6%' or want add 6% of the value?

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...
Jul 29, 2020 0
Engaged ,
Jul 29, 2020

Copy link to clipboard

Copied

I want it to display '+6%'

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...
Jul 29, 2020 0
Most Valuable Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

Use this:

event.value = this.getField("field").valueAsString + "+6%";

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...
Jul 29, 2020 0
Engaged ,
Jul 29, 2020

Copy link to clipboard

Copied

field uses value from another field so it need to be *6+ "%" I just need + sign to appear in front of result,it should look something like this "+"+ *6+ "%" but it says missing before statement.

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...
Jul 29, 2020 0
Most Valuable Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

You wrote:

> I want it to display '+6%'

That's what my code does. I don't understand what you're asking for now.

Bottom line is that everything that you want to add to the value of the field as text needs to be in double-quotes, preceded by a + sign. If you want to include double quotes (or a back-slash) in the string, they have to be preceded by a back-slash.

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...
Jul 29, 2020 0
Engaged ,
Jul 29, 2020

Copy link to clipboard

Copied

Number is not static it's calculated from another field, I just used 6 as example, sry I should have mention that.

Anyway I managed to get it work with var x like this "+" + x*6+ "%". But would like to know if it's possible without var? 

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...
Jul 29, 2020 0
Adobe Community Professional ,
Jul 29, 2020

Copy link to clipboard

Copied

What is the value in x?

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...
Jul 29, 2020 0