Skip to main content
Known Participant
April 4, 2023
Answered

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

  • April 4, 2023
  • 2 replies
  • 818 views

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 + "*";
}
This topic has been closed for replies.
Correct answer JR Boulay

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();

2 replies

JR Boulay
Community Expert
Community Expert
April 6, 2023

"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 Photoshopographe
JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
April 5, 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 Photoshopographe
CeltexanAuthor
Known Participant
April 5, 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?