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

Adjust field textSize from other field

Participant ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

Dear Javascript experts,

I'm trying to do this but it is very wrong.

If 1 field gets lower in textSize the other field has to adjust the same textSize automatically.

var pricefield = this.getField("01_pricefield.pricefield").textSize;

var pricefieldxtr = this.getField("01_pricefield.extra.pricefield").textSize;

if (pricefield < pricefieldxtr) {

pricefieldxtr = pricefield;

} else {

}

Already thanks for the help!

Greetings

TOPICS
Acrobat SDK and JavaScript , Windows

Views

635

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

correct answers 1 Correct answer

LEGEND , Feb 20, 2019 Feb 20, 2019

After your first two lines pricefield and pricefieldxtr are just copies of the current textSize properties. They are not connected to the original. If you want to CHANGE the textSize you need to refer to the textSize on the left side of =

Votes

Translate

Translate
LEGEND ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

After your first two lines pricefield and pricefieldxtr are just copies of the current textSize properties. They are not connected to the original. If you want to CHANGE the textSize you need to refer to the textSize on the left side of =

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
Participant ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

Thank you for you're reply, but I'm having an blackout here, like this?

var pricefield = this.getField("01_pricefield.pricefield");

var pricefieldxtr = this.getField("01_pricefield.extra.pricefield");

if (pricefield.textSize < pricefieldxtr.textSize) {

pricefieldxtr.textSize = pricefield.textSize;

} else {

}

Its so simple but I just can't see it.

Greetings.

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
LEGEND ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

That looks better. What do you expect to happen? Any console messages?

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
Participant ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

No errors,

What I expect to happen?

Well, I have 2 fields with an keybord script (I'm translating this from Dutch).

Both fields have this script.

var a = event.value.length;   

var b = event.target;

if (a < 5) {

    b.textSize = 210;

} else if (a < 6) {

    b.textSize = 150;   

} else {

}

If field 1 is jumping to the textSize 150, the other field has also jump to 150.

P.s both fields have an layout script:

var f = event.target;

f.richText = true;

var spans = new Array();

spans[0] = new Object();

spans[0].superscript = true;

var fDollars = Math.floor (event.value);

spans[1] = new Object();

spans[1].superscript = false;

spans[1].text = util.printf("%.0f", fDollars);

And alot more...

Greetings

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
LEGEND ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

Why would one field jump to 150? Surely it would only jump size if the textSize property is zero?

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
Participant ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

LATEST

I got it working now, thanks to you’r reply.

The form is an bit difficult to explain but you show me the right diriction thank you!

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