This topic is locked

scan a code and insert in a field

12/4/2022 3:39:13 AM
PHPRunner General questions
francesco author

I have a popup windows where I retrieve a partnumber with a qr code scanner and I load this partnumber into the parent window. Till now is not a problem for me.
But if the field I want to compile is indexed, first I have to retrieve the partnumber index and then load into it and that is my problem.

I want to do something like this in OnLoad event, where I have also the scanner code:

$rs = DB::Query("SELECT idcodice FROM codice where partnumber = 'pnumb ' "); //retrieve keyfield from partnumber

But I have an error on that line, so I think my biggest problem is how to write correctly the above line code in OnLoad event

Thanks for your help

aadham 12/4/2022

Try this

SELECT idcodice FROM codice where partnumber = ' ".$values["pnumb"]." ' "
francesco author 12/4/2022

Thanks, I tried but I have same error: Microsoft Javascript compilation error.

My doubt is if is correct in JavaScript Onload use this type of code to retrieve a table value:
$rs = DB::Query("select * from AnyTable where SomeColumn='Specific Value'");
$data = $rs->fetchAssoc();

aadham 12/4/2022

You can't use this code in JS Onload event.
I recommend you read this part of the manual

francesco author 12/5/2022

aadham, i was thinking to put the code to retrieve the keyfield value in custom add of the popup windows. Do you think is it possible? If yes how I can pass the keyfield from popup "child" windows to parent add?
I'm sorry if my question could be very basic, but at this step I'm learning by doing.