Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
SharePoint Form Field Titles and JavaScript

Good afternoon all! Thanks so much for looking. I've got a JavaScript issue here that I'm not sure where I'm going wrong. Here's the scenario:

I have a SP Form with several custom fields that need to have an auto-complete function applied to them. There is a REST call that populates the auto-complete, that part works great. The issue, however, lies with attempting to assign the field TITLE to a variable. Here's what I've got so far:

$(function() {

$("input[title='FIELD1']").autocomplete({
  source: function( request, response ) {
    var term = request.term;
    var restUrl = PWATABLEURL
    
    XXX.PO.Data.loadJSON(restUrl, function (data) {
        var items = [];
        var entries = data.value;
        
        while (entries.length > 0) {
            var entry = entries.shift();        
            var item = { value: entry.ResourceName, label: entry.ResourceName};
            items.push(item);
        }
        response(items);
    });
  },
  minLength: 3
});
$("input[title='FIELD1']").attr("title", "Enter 3 characters to search");


    $(".ui-autocomplete-input").on("autocompletechange", function(e, u){
    $(this).focus();
    $(this).change(); 
}); 
});

In this example, I've explicitly defined 'FIELD1' as the field to apply the function to and all is well. But when i substitute:

let varField = 'FIELD1'
console.log(varField);
$("input[title=varField]").autocomplete.....

it fails with no real help from the console messages--it just doesnt work. The plan was to set up a case switch where it would work like,

If Field title = FIELD1, set varField to 'FIELD1' If Field title = FIELD2, set varField to 'FIELD2' etc..

In this way each field we needed to apply the auto-complete function to would get the same block of code without using repeating sections in the script.

I'm still plugging away, but i feel like I'm missing something easy here as i can't even get to a single variable, much less multiple. Any and all input is appreciated and as always, thanks to the community for taking the time.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda