cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Running validator after textbox input

ague
13-Aquamarine

Running validator after textbox input

I have a textbox, and the text is bound to a validator widget. The validator widget checks to make sure that the input is not null/empty, and if not, it runs a service. Everything works as expected, but the validator only runs when the user clicks off the textbox (I have no enter/submit button). 

 

I want to rework this so that the validator runs without the user clicking off - or, make this automatic some how. 

 

Any thoughts?

ACCEPTED SOLUTION

Accepted Solutions
Constantine
17-Peridot
(To:ague)

There it is from the DataWedge spec, by the way:

 

enter.png

View solution in original post

8 REPLIES 8
zyuan1
18-Opal
(To:ague)

I think the textbox is working as expected, you need to click out, or press the Enter/Tab in the keyboard to finish the string input.

ague
13-Aquamarine
(To:zyuan1)

Yes, as per my original post, I confirmed that the text box is working as expected when I click off it. I'm just wondering if there's a way to do this without clicking off it. 

 

The background of my request is this - I'm building an application that scans a QR code. I can scan the code, and put it in a text box successfully. But then the user is forced to click somewhere else on the page in order to be able to do anything further. I want the application to work automatically just when the user scans, without artificially forcing him to click somewhere else just to get the services to run. 

zyuan1
18-Opal
(To:ague)

You can bind it to both a Label widget and a textbox widget, and use Events Router widget to bind to the final result.

 

The Label helps you get the result without clicking outside, the textbox widget allows you to still make modifications to the string, and events router helps you get both the results

Constantine
17-Peridot
(To:ague)

Hello,

 

What do you use for scanning QR codes? If that's some hardware solution simulating keystrokes, it might be able to simulate pressing <ENTER> at the end of the scan, which will effectively "click out" of the text box.

 

/ Constantine

ague
13-Aquamarine
(To:Constantine)

That's a great point - I'll look into that! 

 

I'm working with a Zebra Scanner and I'm using DataWedge to read/scan both QR and traditional bar codes.

Constantine
17-Peridot
(To:ague)

Just thought about it... there's another nice side-effect if you manage to make <ENTER> work -- the text field doesn't lose focus in this case. You'll just need to call its ResetToDefaultValue when you're done processing to allow serial scanning of QR codes. Of course that won't help if the user actually clicks out of the textbox, but that's also something you can avoid by resizing your textbox to cover entire mashup. I know that sounds and looks even more weird, but it may be a quick and practical workaround.

Constantine
17-Peridot
(To:ague)

There it is from the DataWedge spec, by the way:

 

enter.png

ague
13-Aquamarine
(To:Constantine)

Thank you, @Constantine! This ended up working for me!

 

Announcements


Top Tags