Skip to main content
Solved

block typing in lookup field

  • 13 June 2024
  • 4 replies
  • 54 views

On mobile, is it possible to stop typing in the lookup field and perhaps stop typing in a field for reading the qrcode? If it is possible via script, can you give an example?

4 replies

Userlevel 3
Badge +7

Hi @WilsonX 

You can’t use only qr scanner as a input of text field.

This requirements can do from customisation.

 

Thanks

Userlevel 3
Badge +5

Hi @WilsonX ,

Your requirement cannot be done using configurations. There are no specific fields dedicated to QR scanning or barcode scanning. This feature is available for all input fields in FSM Mobile. You can enable or disable this feature using the ENABLE_BARCODE_SCANNING app param.

Userlevel 2
Badge +4

@WilsonX, As mentioned in above comments, it is not possible to validate the user inputs inside the lookup screen.

 

But you can restrict the inputs which are being entered directly to the actual field using a script like below.

As QR/Barcode scanner in latest FSM update returns the scanned text all at once you can differentiate the user input by checking the text size in ValueChanged action on the field (given that there are no barcodes which return only one character).

 

var curVal = getControlValue("c_acme_shipping","place_id");

//Get Current Length
var curInputLength = curVal.length;

if(curInputLength == 1) {
//Replace the current field value with a empty value
setControlValue("c_acme_shipping","place_id", null);
alert("Not Editable from User Input");
}

 

As a workaround (if the requirement is critical to the business) you can build a custom search screen using scripting/list screen and utilizing the cache functions in the client scripts. And trigger it once the user scanned the barcode to a field (or via a button). 

Badge +4


Thank you all. I had already created something along the lines that @IniNimesK  suggested. adding the script in changed value in all the fields that I deemed necessary

var screenName = getCurrentScreenName();

var tabela = "";
var campo = "";
var getValida ="";

////Retorna campo de qrcode na tela de overview
if (screenName == "DebriefOverview"){ tabela = "task"; campo = "user_def21";}

////Retorna campo de qrcode na tela de overview
if (screenName == "c_DebriefPartUsage"){ tabela = "part_usage"; campo = "user_def10";}

////Retorna campo de modelo de encerramento na tela cadastro de novo produto
if (screenName == "Cadastro Novo Produto"){ tabela = "product"; campo = "model_id";}

//Retorna campo de peça de encerramento na tela de peças usadas
if (screenName == "DebriefPartNeeds"){ tabela = "part_need"; campo = "part_id";}

//Retorna campo de classificação de encerramento na tela de revisão do cliente
if (screenName == "DebriefCustomerReview"){ tabela = "task"; campo = "user_def22";}

//Pegar digitação atual do campo
getValida = getControlValue(tabela, campo);

//Apagar caracter campo

if (getValida.length == 1) {
setControlValue(tabela, campo,"");
if (screenName == "DebriefOverview"){
alert("Pressione o campo e selecione a opção de digitalização de cód. de Barras");
}
else {
alert("Toque na lupa ao lado para realizar a pesquisa");
}
}
if (getValida.length == 1) {
setControlValue(tabela, campo,"");
alert("Toque na lupa ao lado para realizar a pesquisa");
}

 

Reply