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

Pop-up response input not immediately changing value in a field after clicking OK

Explorer ,
Apr 04, 2023 Apr 04, 2023

I have a read-only field with the 3 of 9 barcode font to accept input from a pop-up response window. When you click on the barcode field, the response window does pop up and accepts the input value, but when clicking on OK, the barcode does not change. Only when another action is taken afterward does the barcode change. I have the script below in the Mouse Up action of the barcode. How can I have it change the moment you click OK?

var cRtn = app.response("Please enter barcode number", "Barcode");
if(cRtn != null)
{
    this.getField("txtBarCode").value="*" + cRtn + "*";
}
TOPICS
JavaScript , PDF forms
675
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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 05, 2023 Apr 05, 2023

Add a invisible read only field, named "focuss" in this example, and add this line at the end of the script :

var cRtn = app.response("Please enter barcode number", "Barcode");

if(cRtn != null) {this.getField("txtBarCode").value="*" + cRtn + "*";}
this.getField("focuss").setFocus();


Acrobate du PDF, InDesigner et Photoshoptographe

View solution in original post

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, 2023 Apr 05, 2023

Add a invisible read only field, named "focuss" in this example, and add this line at the end of the script :

var cRtn = app.response("Please enter barcode number", "Barcode");

if(cRtn != null) {this.getField("txtBarCode").value="*" + cRtn + "*";}
this.getField("focuss").setFocus();


Acrobate du PDF, InDesigner et Photoshoptographe
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, 2023 Apr 05, 2023

Thank you very much, JR! That worked but leaves the cursor blinking wherever I have set that field. Would I be able to use the "setFocus" on an already existing field to simply have the cursor sitting there for the user's next input? 

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, 2023 Apr 06, 2023
LATEST

"Would I be able to use the "setFocus" on an already existing field to simply have the cursor sitting there for the user's next input? "

Yes, just replace "focuss" in the script by the field's name :

var cRtn = app.response("Please enter barcode number", "Barcode");

if(cRtn != null) {this.getField("txtBarCode").value="*" + cRtn + "*";}
this.getField("focuss").setFocus();


Acrobate du PDF, InDesigner et Photoshoptographe
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