I have a company invoice bar code entry form, which has fields such as driver, used car on delivery, and so on. So that at the time of entry, the user does not have to fill in the information for each note, I use:
body onload='window.history.back();'
In this way, the form is already filled in with the previous information.
It turns out that the specific field for the barcode also returns filled, causing users to delete it to read the next code.
Does anyone know how I can reload the page only with this clean barcode field? I am new to PHP
, javascript
and such ...
Edit:
Follow my form:
<form action="verif_codigo.php" method="POST">
<!-- Select Motoristas -->
<select class="form-control" name="motorista">
<option value="0">Selecione o motorista...</option>
<option value="1">Opção 1</option>
<option value="2">Opção 2</option>
<option value="3">Opção 3</option>
</select>
<!-- Select Carros -->
<select class="form-control" name="carro">
<option value="0">Selecione o carro...</option>
<option value="1">Opção 1</option>
<option value="2">Opção 2</option>
<option value="3">Opção 3</option>
<option value="4">Opção 4</option>
</select>
<!-- Input Código de Barras -->
<input class="form-control" type="text" id="codigo" name="codbarras" placeholder="Digite aqui o código de barras da NF-e..."/>
<input class="form-control btn btn-primary btn-sm" type="submit" value="Gravar"/>
<input class="form-control btn btn-warning btn-xs" type="reset" value="Limpar"/>
</form>
I have this form, when the user clicks submit, the data is written to the database and the form reloads using the body onload
I mentioned earlier. But the form reloads all filled up, and I need the codbarras
field to reload blank, so that the user only reads the next code without having to delete the field.
The best I've achieved so far was to use:
onclick="document.getElementById('codigo').value='';"
No input
of field codbarras
, except that this only goes away if you click on the field ...