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
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 =
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 =
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.
Copy link to clipboard
Copied
That looks better. What do you expect to happen? Any console messages?
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
Copy link to clipboard
Copied
Why would one field jump to 150? Surely it would only jump size if the textSize property is zero?
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!