Copy link to clipboard
Copied
hello
I have Text1 and Text2. i want If Text1 has the value >=2001 then Text2 will take the value 01(not 1 but 01).
Thanks
OK. First of all, make sure the Format option of Text2 is set to None and then use this code as its custom calculation script:
event.value = (Number(this.getField("Text1").value) >= 2001 ? "01" : "");
Copy link to clipboard
Copied
And if Text1 has a value smaller than 2001, or empty, what should Text2 be?
Copy link to clipboard
Copied
smaller than 2001 it does not apear
Copy link to clipboard
Copied
OK. First of all, make sure the Format option of Text2 is set to None and then use this code as its custom calculation script:
event.value = (Number(this.getField("Text1").value) >= 2001 ? "01" : "");
Copy link to clipboard
Copied
about the ext solution.It works but when i delete the number of the Text1 the number 01 on Text 2 still apear.Maybe to do something with format script?
Copy link to clipboard
Copied
sorry not with format but with validation script and especially with display.visible : display.hidden?
Copy link to clipboard
Copied
The field itself will appear, but will be empty. Do you want to hide it entirely?
Copy link to clipboard
Copied
yes
Copy link to clipboard
Copied
Then use this code:
if (Number(this.getField("Text1").value) >= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}
Copy link to clipboard
Copied
Hello.
It is crazy.It works but when i clear Text1 then Text2 keep the value 01.I tried everything to clear 01 ,but it is still there.
Thanks
Copy link to clipboard
Copied
Can you share the file (via Dropbox, Google Drive, Adobe cloud, etc.)?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Text113 is on page 4, and I don't see any scripts associated with it.
Copy link to clipboard
Copied
Sorry it is Text38 page 3
Thanks
Copy link to clipboard
Copied
That's because the code you used is not the code I posted... Your actual code is:
if (Number(this.getField("Textfield25").value) <= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}
But when the value of "Textfield25" is blank it gets converted to zero by the Number function, so there's a need to add another condition, like this:
if (this.getField("Textfield25").valueAsString!="" && Number(this.getField("Textfield25").value) <= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}
On top of that there's something else wrong with that field. I can't enter more than 3 characters to it, even though the comb is set to 4. I suggest you delete it and then re-create it, or remove the comb option and then re-apply it.
Copy link to clipboard
Copied
i do not know where to add it.I tried everything.
Also i delete Textfield25 and i made a new one with comb 4
Copy link to clipboard
Copied
The calculation script of Text38, just like before...
Copy link to clipboard
Copied
ok I"ve done it. Can you please take a look.Thanks
Αντίγραφο από ΕΡΓΑΤΙΚΟ ΔΥΝΑΜΙΚΟ ΕΤΟΥΣ 2016.pdf - Google Drive
Copy link to clipboard
Copied
You didn't change anything in the code.
Copy link to clipboard
Copied
I enter to the calculation script this
if (Number(this.getField("Textfield25").value) <= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}if (this.getField("Textfield25").valueAsString!="" && Number(this.getField("Textfield25").value) <= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}
Copy link to clipboard
Copied
The code I gave you should replace the old code, not be used with it.
Copy link to clipboard
Copied
Ok I enter only this code and i have the same situation as before
if (this.getField("Textfield25").valueAsString!="" && Number(this.getField("Textfield25").value) <= 2001) {
event.value = "01";
event.target.display = display.visible;
} else {
event.value = "";
event.target.display = display.hidden;
}
Αντίγραφο από ΕΡΓΑΤΙΚΟ ΔΥΝΑΜΙΚΟ ΕΤΟΥΣ 2016.pdf - Google Drive
Copy link to clipboard
Copied
As I said earlier, there's something wrong with that field. I removed it, saved the document, re-opened it and then re-created the field. It's working correctly now. See: Αντίγραφο από ΕΡΓΑΤΙΚΟ ΔΥΝΑΜΙΚΟ ΕΤΟΥΣ 2016(2).pdf - Google Drive
Copy link to clipboard
Copied
It is crazy.For the history which field did yoy re-create Text38 or Textfield25?
Copy link to clipboard
Copied
Textfield25
Find more inspiration, events, and resources on the new Adobe Community
Explore Now