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

Text1 and Text2

Explorer ,
Apr 05, 2016 Apr 05, 2016

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

TOPICS
Acrobat SDK and JavaScript
2.5K
Translate
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

Community Expert , Apr 05, 2016 Apr 05, 2016

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" : "");

Translate
Community Expert ,
Apr 05, 2016 Apr 05, 2016

And if Text1 has a value smaller than 2001, or empty, what should Text2 be?

Translate
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
Explorer ,
Apr 05, 2016 Apr 05, 2016

smaller than 2001 it does not apear

Translate
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 ,
Apr 05, 2016 Apr 05, 2016

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" : "");

Translate
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
Explorer ,
Apr 05, 2016 Apr 05, 2016

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?

Translate
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
Explorer ,
Apr 05, 2016 Apr 05, 2016

sorry not with format but with validation script and especially with display.visible : display.hidden?

Translate
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 ,
Apr 05, 2016 Apr 05, 2016

The field itself will appear, but will be empty. Do you want to hide it entirely?

Translate
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
Explorer ,
Apr 05, 2016 Apr 05, 2016

yes

Translate
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 ,
Apr 05, 2016 Apr 05, 2016

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;

}

Translate
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
Explorer ,
Apr 05, 2016 Apr 05, 2016

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

Translate
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 ,
Apr 06, 2016 Apr 06, 2016

Can you share the file (via Dropbox, Google Drive, Adobe cloud, etc.)?

Translate
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
Explorer ,
Apr 06, 2016 Apr 06, 2016
Translate
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 ,
Apr 06, 2016 Apr 06, 2016

Text113 is on page 4, and I don't see any scripts associated with it.

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016

Sorry it is Text38 page 3

Thanks

Translate
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 ,
Apr 11, 2016 Apr 11, 2016

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.

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016

i do not know where to add it.I tried everything.

Also i delete Textfield25 and i made a new one with comb 4

Translate
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 ,
Apr 11, 2016 Apr 11, 2016

The calculation script of Text38, just like before...

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016
Translate
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 ,
Apr 11, 2016 Apr 11, 2016

You didn't change anything in the code.

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016

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;

Translate
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 ,
Apr 11, 2016 Apr 11, 2016

The code I gave you should replace the old code, not be used with it.

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016

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

Translate
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 ,
Apr 11, 2016 Apr 11, 2016

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

Translate
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
Explorer ,
Apr 11, 2016 Apr 11, 2016

It is crazy.For the history which field did yoy re-create Text38 or Textfield25?

Translate
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 ,
Apr 11, 2016 Apr 11, 2016
LATEST

Textfield25

Translate
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