Page 1 of 1

Stripping Characters from Textbox Entries

Posted: Thu May 18, 2017 4:37 pm
by James-S
We have a user requirement which includes the use of barcode readers to do input into a textbox widget. The barcode reader adds a “tab” character at the end of the converted barcode data.

Questions:
  • Is there a way to strip the added “tab” character (eg. Javascript)?
  • After the input is stripped of the extra character, is there a way to set focus to another textbox widget? I know there is a focus property but the goal is to do all the barcode entry to multiple textbox’s and not return to the RPG program each time.

Re: Stripping Characters from Textbox Entries

Posted: Thu May 18, 2017 4:51 pm
by Scott Klement
Is there a way to strip the added “tab” character (eg. Javascript)?
Yes, you can retrieve the value of a textbox with the pui.get() API, and set it's value with the pui.set() API.

Code: Select all

var x = pui.get("the-id-of-the-textbox");
... code here to strip chars from x ...
pui.set("the-id-of-the-textbox", x);
After the input is stripped of the extra character, is there a way to set focus to another textbox widget? I know there is a focus property but the goal is to do all the barcode entry to multiple textbox’s and not return to the RPG program each time.

Code: Select all

getObj("the-new-textbox-id").focus();

Re: Stripping Characters from Textbox Entries

Posted: Thu May 18, 2017 4:59 pm
by James-S
Perfect. I knew these functions but just couldn't get my mind around using them in this context. Got caught up more in the requirements than focusing on what solutions are available.

Thank you Scott!