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

before statement

Community Expert ,
Jul 27, 2020 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

879

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
community guidelines
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

What are you trying to achieve, exactly?

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 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.

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

I want it to display '+6%'

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Use this:

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

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 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.

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 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.

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 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? 

Votes

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
community guidelines
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

LATEST

What is the value in x?

Votes

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
community guidelines