Adjust field textSize from other field

Participant ,
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

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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 =

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

269

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

Adjust field textSize from other field

Participant ,
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

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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 =

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

270

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
Feb 20, 2019 0
Most Valuable Participant ,
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 =

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

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...
Feb 20, 2019 0
Most Valuable Participant ,
Feb 20, 2019

Copy link to clipboard

Copied

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

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

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...
Feb 20, 2019 1
Most Valuable Participant ,
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?

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

Copy link to clipboard

Copied

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!

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