Chrome Auto Complete fills wrong fields

Asked

Viewed 83 times

2

I have a WEB application that queries dynamically using SQL. After the Chrome update, all system inputs are coming with the user name already filled in.

Example: value = 'SUPERVISOR' value should be blank.

Someone knows how to fix this?

Here comes part of the Code

//Função click para buscar dados
$("#formConsult").submit(function(){
  newQry();
  return false;
})

//Função que faz a query
function newQry(){
  var thisButton = $("#loadAll");
  thisButton.button('loading');
  var id_consult = $("#loadAll").attr("data-id");
  var input_array       = new Array();
    var type_input        = new Array();
    var name_paramers     = new Array();
    var newParamers_array = new Array();
    var sql = "";

    if(id_consult !== 0){
      if(allConsult_array.length > 0){
        for(var key = 0; key < allConsult_array.length; key++){
          var consult = allConsult_array[key];
          if(consult.ID_Consulta_Dinamica == id_consult){
            sql = consult.Sql;
          }
        }
      }
    }

    //to check if exists paramers
   $('#boxParamers input').each(function(i, elem){
      input_array.push($(elem).val());
      type_input.push($(elem).attr('name'));
      name_paramers.push($(elem).attr('data-nameParamers'));
   })



   if($(input_array).length > 0){

      for(var key in input_array){

        if(type_input[key] == 'data'){

          var date = input_array[key].split("/");

          var new_date = date[2]+"-"+
                         date[1]+"-"+
                         date[0];
            newParamers_array.push(new_date);


            if(key == 0){//begin if
                sql = sql.replace('{D_(DE)}', "'" + newParamers_array[key] + "'");
              }//end if
              if(key > 0){//begin if
                sql = sql.replace('{D_(ATE)}', "'" + newParamers_array[key] + "'");
              }//end if

        }//end if


        else if(type_input[key] == "periodo"){//begin else if
          newParamers_array.push(input_array[key]);

             for (var i = 0; i < name_paramers.length; i++) {
                var p = newParamers_array[i];
                p = p.replace('-', '');
                p = p.replace('-', '');

                var numero = /^[0-9]+$/;
                p = p.match(numero); 
                if(p !== null){
                  sql = sql.replace('{' + name_paramers[i] + '}', "'" + newParamers_array[i] + "'");
                }else{
                  sql = sql.replace('{' + name_paramers[i] + '}', "'%" + newParamers_array[i] + "%'");
                }
                  sql = sql.replace('{'+name_paramers[i]+'(AAAAMM)}', "'"+newParamers_array[i]+"'");
              }
        }

      }

     buscaQuery(sql);

   }else{
      //to send sql
      buscaQuery(sql);
   }

}


//Função que faz a consulta sql
function buscaQuery(sql){
  $.ajax({//begin function
    url: api,
    type: "POST",
    dataType: "json",
    data:{
      request: "sendSQL",
      sql:     sql,
    },
    success: function(response){
      $("#loadAll").button('reset');
      switch(response.status){
        case 0:
          messageError();
        break;

        case 1:
          allData = response.response;
          dataGridTable(response.response);
        break;

        case 2:
          messageErrorSQL(response.response)
        break;
      }
    },
    error: function(status, xhr, error){
      $("#loadAll").button('reset');
      messageErrorAll(xhr,error, status);
      console.log(status);
      console.log(xhr);
      console.log(error);
    },//end error function
  })//end ajax function
}

//Função que Faz a Grid (DATAGRID DEVEXTREME)
function dataGridTable(consult){

  $("#gridContainer").remove();
  $("#autoExpand").remove();
  $(".options").remove();
  $("#expandlle").remove();

  var moeda         = "";
  var quantidade    = ""; 
  var contagem      = "";
  var cols          = new Array();
  var column        = new Array();
  var teste = new Array();
  var sum_total = new Array();
//Colunas
  for(var key in consult[0]){
    teste.push(key);

    column = 
    {
      dataField: key,
      caption: key,
      customizeText: function (options){
        var  col = this.dataField;
        var type = "";

        if(col !== undefined && col !== null && $.trim(col) !== "" && $.trim(col) !== ""){//begin if

          if(col.match(/V(?=_)/)){//begin if
            type = 0;//moeda
          }//end if

          if(col.match(/Q(?=_)/)){//begin if
            type = 1;//quantidade
          }//end if

          if(!col.match(/Q(?=_)/) && !col.match(/V(?=_)/)){
            //Verifica se a coluna é do tipo Data

            if(col.match(/DATA/)){
              type = 2;
            }else{
              type = 3;
            }
          }

        }else{//begin else
          return options.value;
        }//end else

        switch(type){

          case 0:
            return formatValueCol("moeda",options);
          break;

          case 1:
           return formatValueCol("quantidade",options);
          break;

          case 2:
            return options.value;
          break;

          case 3:
            return options.value;
          break;

        }
      },
      cellTemplate: function (container, options) {
          type = "";

        if(options.column.caption.match(/V(?=_)/)){
          type = "moeda";
        }

        if(options.column.caption.match(/Q(?=_)/)){
          type = "quantidade";
        }

        if(options.column.caption.match(/C(?=_)/)){
          type = "contagem";
        }

        if(!options.column.caption.match(/V(?=_)/) && !options.column.caption.match(/Q(?=_)/) && !options.column.caption.match(/C(?=_)/)){//begin if
          type = "string";
        }//end if

          return formatValueDateCount(type,container,options);

      }//end funtion
    }

    cols.push(column);

    if(key.match(/V(?=_)/)){//begin if
        moeda =
        {
            column:  key,
            summaryType: "sum",
            customizeText:function(options){
              return formatValue("moeda",options);
            }
          };

        sum_total.push(moeda);   
    }//end if

    if(key.match(/Q(?=_)/)){
      quantidade =  
      {
            column: key,
            summaryType: "sum",
            customizeText:function(options){//begin function
              return formatValue("quantidade",options);
            }//end function
          },
      sum_total.push(quantidade); 
    }

    if(key.match(/C(?=_)/)){
      contagem = 
      {
            column: key,
            summaryType: "count",
            customizeText:function(options){//begin function
              return formatValue("contagem",options);
            }//end function
      }
      sum_total.push(contagem); 
    }

  }


    $(".gridAllData").append("<div id='gridContainer' style = 'max-height: 500px;'></div>");
//Grid Comum
   $("#gridContainer").dxDataGrid({
        dataSource: consult,
        allowColumnReordering: true,
        allowColumnResizing: true,
        columnResizingMode: "widget",
        columnAutoWidth: true,
        showColumnLines: true,
        showRowLines: true,
        rowAlternationEnabled: true,
        showBorders: true,
        cellHintEnabled: true,
        noDataText: "Sem Registros",
        height: '100%',
        "export": {
            enabled: true,
            fileName: "Consulta Dinamica",
            allowExportSelectedData: false,
            texts:{
              exportAll: "Exportar Dados",
            },
        },
        grouping: {
            autoExpandAll: false,
            texts:{
              groupContinuedMessage: "Continua na Página Anterior",
              groupContinuesMessage: "Continua na Próxima Página",
            }
        },
        pager: {
            showPageSizeSelector: true,
            allowedPageSizes: [5,10,20,50,100],
            showInfo: true,
            infoText: "Página {0} de {1} ({2} Itens)",
        },  
        paging: {
             pageSize: 10
        },
        groupPanel: {
            visible: true,
            emptyPanelText: "Arraste o cabeçalho de uma coluna aqui para agrupar por essa coluna.",
        },
        columnChooser: {
            enabled: true,
            emptyPanelText: "Arraste uma coluna aqui para escondê-la!",
            mode: "dragAndDrop",
            title: "Esconder Colunas!"
        },
         //Opções de Filtro
        filterRow: {
          visible: true,
          applyFilter: "auto",
          betweenEndText: "Data Inicial", 
          betweenStartText: "Data Final",
          resetOperationText: "Limpar",
          operationDescriptions: 
          { 
            between: "Entre", 
            contains: "Contém", 
            endsWith: "Termina com", 
            equal: "É igual a", 
            greaterThan: "Maior que", 
            greaterThanOrEqual: "Maior ou Igual a", 
            lessThan: "Menor que", 
            lessThanOrEqual: "MEnor ou Igual a", 
            notContains: "Não Contém", 
            notEqual: "Não é igual", 
            startsWith: "Começa com" 
          }, 
          showAllText: "(Todos)",
        },
        headerFilter: {
            visible: true,
            texts:
            {
              cancel: "Cancelar",
              emptyValue: "(Sem Registro)",
              ok: "Ok",
              cancel: "Cancelar",
              emptyValue: "(Sem Registro)",
              ok: "Ok",
              showAllText: "(Mostrar Todos)",
            },
        },

        columns: cols,
        summary: {
          totalItems: sum_total,
          groupItems: sum_total,
        }
    })

}
<form id = 'formConsult'>
  <div class="row">
    <div class="col-sm-5">
   <select class="form-control" id = "selectAllConsult" name="selectAllConsult"> 
   </select>                 
  </div>
  <div id = 'boxParamers' style="display: none;"></div>
    <div class="col-sm-2">
      <button type="submit" data-id = "" class="btn btn-primary" id="loadAll" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Carregando"><i class="fa fa-search"></i> Buscar</button>
   </div>
 </div>
</form>

  • 1

    Enter your code or part of it so we can analyze.

  • You tried to add the property autocomplete="off" in your inputs? Include your html, there are other factors that can influence this behavior.

  • Yes... Chrome ignores this attribute...

  • <input autocomplete="off" class="dx-texteditor-input" type="text" spellcheck="false" role="textbox" tabindex="0" style="text-align: left;"> and it’s still filled in

  • Has anyone got a good solution for this Chrome who lives doing what he wants?... I’m having trouble with Rome filling out fields that have nothing to do... even on machines that haven’t had access to the page yet... is it the names of fields? I’ve tried to change and nothing.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.