I'm developing an web based Application using PHP & MySQL. My application requires the user to shot a Barcode Scanner to an AUTOFOCUS-ed field in my product entry form, after this AUTOFOCUS-ed field is filled with code shot form the BARCODE Scanner, the form presents a list of similarly coded products (THe products I'm scanning could have similar Barcodes but different Prices), out of which the user needs to select a particular product.
The Scanner I'm using is TVS BSC-101 STAR Scanner, which is most popular in India. The problem is that it is reading ENTER as appending code and I need to program it to append TAB (or something that emulates the TAB button on Keyboard) otherwise it is just not moving to the next field where the user based on the code scanned, gets a list of similarly coded products list.
Can anyone help me out in here, appreciate your help.
reading enter should trigger a page reload, isn't it?
if that's the case, implement a PHP function that read the barcode and output the similar ones.
otherwise you could inhibit the enter keypress via javascript and simulate a tab keypress
Related
I am using the autocomplete element from the Moodle Form API on a Moodle form. I preload the autocomplete element with a list, set multiple to true, and tags to true. This allows the user to add elements to the list if they don't already exist. A user can add an element by typing in the text and either clicking enter or clicking off of the autocomplete element. This event will take whatever the text is in the autocomplete and add it to the list. I don't want an element to be made every time the user has entered text and clicks off of the autocomplete, rather just when the user has entered text and clicks enter. Is there a way to do this using Moodle's Form API autocomplete or should I go about this a different way?
There is no easy solution to this issue. However I believe I have started to find a way to do what you would like. If you go into lib\amd\src\form-autocomplete.js and head down to about line 728 (using Moodle version 3.7) you will see this line:
return createItem(options, state, originalSelect);
This is the line that triggers the creation of a new tag whenever the auto-picker gets its focus lost (click off). If you comment out this line, that click off event will no longer trigger that creation. However it must be noted that this will cause it to be disabled across your whole site, for all auto-pickers.
Obviously I do NOT recommend doing this, as with it being a core Moodle function it will most likely revert as soon as you update Moodle, causing many potential issues down the road. However, as this question has not seemed to get much attention, I wanted to add this just to give you and/or other people viewing this somewhere to start.
I am currently looking into creating a copy of autocomplete.php (the php element that mform uses for auto-pickers) and adjusting its calls to use a separate, slightly adjusted version of lib\amd\src\form-autocomplete.js. I will update you with any progress I personally make, but hopefully this information can get the ball rolling for you or other developers on this site.
Is it possible to create barcode to submit HTML form and do MySQL update via PHP? I've never done something like that, but currently I'm building some application that will track job done in some Injection Mold company. Can I use mobile barcode scanner or we need dedicated barcode scanner? First, I thought about barcode that will automatically open URL in form like this
https://example.com/verif.php?pos=12&op=10&true=1
And that link will submit form I want. Or something like barcode scanner directly submit form without opening URL? I need advice.
Thanks!
I've worked with barcode scanners before. The barcode represents a string, and all that the scanner will do is read and paste it onto whatever format you have on the computer, in my case, it was on excel sheets, a field in an app, etc. Your scanner will come with a program where you can customize the action upon scanning.
You can definitely use a mobile scanner.
If you want it to submit a form without opening URL, you need to create a form submission platform, which needs to automatically submit and automate that process. Speed can be a key depending on how quickly you expect to scan.
I would like to offer the ability for users to open a form built using PHP/HTML and then on that form have a box which allows them to search for employees then want to send the form to without having to submit the form at this stage.
They will get a search box which allows them to enter the name or part name, the query then finds all employees which match the input string and they then choose the correct employee and that respondent is added to a list and they then search for the next employee and so on until they have added as few or many as they like.
Once they have selected the names, they then fill in some other standard fields on the form and then a separate entry is created in the "forms" table for each request sent.
Happy how to do the last part in terms of entering it into the database etc and how to do a "normal" search in PHP/MySQL but what should I do for the search within a form and add to the list pre submitting?
the technique you are looking for is AJAX which uses javascript to examine the form field as they type, talk to the php, get data, then show it back to the user without having to reload the page or sumbit the form. The exact thing you describe is called auto complete which there are many prebuilt tools for (or you can build your own custom one with some js knowledge). I am not going to try to post all the code here since it would be rather long and involved but if you search around these terms you will surely find what you need.
This can all be achieved with Javascript.
If you have a small number of employees, you could send an array of employees with the page. Use an 'onchange' event in the form field so that with each keypress you run a lookup matching the employees against the typed text.
It's likely that you don't have a small enough number of employees, and also I'm not sure best practice advocates sending your entire company address book inside a web page! In that case you will need to do the same using Javascript ajax calls within the page. On each keypress, fire a request back to the server asking for employees matching the text string.
You will need to dynamically display the matching employees in another form widget that allows for selection, or maybe as text with checkboxes etc.
There are plugins that manage all the client side part of this but you will still have to put together your own web service to do the employee lookup.
I have developed an attendance taking system with PHP and I am running it on localhost. The system is like this:
Suppose a student has a bar coded ID card and to take his attendance there is a barcode reader and the form I have developed. The barcode reader I have automatically pushes the submit button so as soon as I trigger the barcode reader's button, the value from the barcode is taken and after some processing some values are inserted into the database.
Now it is working fine, but the problem is every time I take the attendance I need to open up the form first and then take the attendance. (I need to take attendance several times a day.) I was wondering if there is any way to take the attendance without having to open up the form repeatedly.
If there is no solution for it, is it possible to keep the form page minimized and take attendances while someone is working on computer (doing something else)?
This depends on how your barcode reader works, mostly. I infer from your description that:
The barcode reader, when activated, sends the data and emulates Enter
The data is populated in the active input element, or, I assume, anywhere that keyboard characters are accepted. Can be tested by opening a text editor and seeing if the data is accepted followed by a newline.
Next, you have a web application, which doesn't run in the background. Technically it's still active on the browser even while minimized, but once minimized the browser is no longer the application with focus, and therefore the data doesn't go to it.
So you have two problems:
You need a way to get data from the barcode reader without affecting the current application. In other words, if someone is using a word processor, you don't want the barcode reader to suddenly insert random information in their work.
You need an application or service to "listen" to the barcode reader and interact with the database. You could write it so that it pops up a dialog or something in the event of a misread, incorrect attendee, etc.; however if the computer needs to be used for something else while attendance is being taken, that could be annoying.
Hopefully your barcode reader vendor has some information available to you which can help you solve problem 1. As for problem 2, I don't have any advice except to consider rewriting your application as a service or application that you can minimize.
I would imagine the scanner comes with software that in one way or another, would let you execute a command when a barcode scan event occurs.
then just craft the command
php attendance.php "...barcode data..."
I bet the scanner comes with documentation that would be at least somewhat helpful.
If i have a website running php and apache, what do i need to be able to attach a scanner to it? How do i get the scanner to fill in a value on one of the webforms on my page?
I just did this for an application. It's actually simple. The scanner is just another input method and is, in fact, similar to a keyboard. When you scan the barcode the data is decoded by the scanner and sent to whatever application is waiting to receive it. In the case of a web-based application it would be a form, most likely with a textarea with focus. The data would then populate the textarea just as if someone had typed the barcode's data into it. The form is then submitted and processed normally.
Just make sure the textarea has focus or else the data will go either nowhere or to wherever focus is (which may be another form field or the address bar).
I have yet to figure how how to get the form to auto-submit upon the entry of the barcode data as the scanner does not send event information (i.e. submit) and special characters such as tab (\t) do not seem to work. (If anyone knows how to accomplish this I am very interested in knowing how it can be done).
For actually creating barcodes in PHP, you might want to have a look at:
http://www.mribti.com/barcode/
http://www.ashberg.de/php-barcode/
Usually, these scanners are equivalent to a keyboard input, so you just select the appropriate input point on the web page, scan, and then submit the form.
WASP makes a line of barcode scanners that simply plug into USB or PS/2 inputs and basically convert the barcode scanned into the characters, just like a user typed them using a keyboard. They have an FAQ and help videos that may be of assistance, too.
When designing your web app, depending on how users interact with it, you can use Javascript to move focus from one field to another so that a user can scan barcodes sequentially without having to click on the field where the characters go. (Similar to how some forms move focus as you type data with a known length, such as a zip code or phone number.)
You can try this:
I think this is the best way to integrate barcode in web application
using php.
integrating barcode scanner into php application?
I hope this link is usefull to all.
Using an autofucus input is the better way. You just have to make sure that you create a for and add autofocus to the input box. So each time a user scans any item, the form is automatically submitted. So just give the form an id and handle the data easily with jquery