Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forÂ
Hey all!
So I've been looking for a way to create a search field in Nintex forms that looks up values from another list where they contain the text entered into a text box. Today I came across this fantastic post which brilliantly solves my issue!!
Nintex Form search field
I still have one small problem, I'm no good at JavaScript... but I'm learning! So all works perfectly as long as the lookup is on the source list's Title field but the moment I change the JavaScript to reference a different field it just loads without returning anything, I'm obviously doing something wrong but not sure what.
This is the Custom JavaScript used, instead of Title I'd like to return the values in the BMC_Description column:
NWF$(document).ready(function() { //The source data for the autocomplete is the GL Material Groups list //Store the titles in a array variable var itemsReturnedVar = []; NWF$().SPServices({ operation: "GetListItems", async: false, listName: "GL Material Groups", CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>", //the name needs to be changed accordingly completefunc: function (xData, Status) { NWF$(xData.responseXML).SPFilterNode("z:row").each(function() { itemsReturnedVar.push(NWF$(this).attr("ows_Title")); }); } }); //ControlVar is added on the control in the NF NWF$("#" + ControlVar).autocomplete({ source: itemsReturnedVar }); });
Solved! Go to Solution.
have you noticed the field is refereed twice there?
I did but since I am not experienced in JavaScript I wouldn't be able to tell you why, what I can say is that if I change the first Reference to my Column that I want to retrieve it has no effect and all still functions as if it were referencing the Title field, if I change both to the desired column name then all stops working... like it's trying to load data but can't...
This is why I was hoping someone who understands JavaScript could advise what I'm doing wrong.
javascript seems to be correct. it works for Title after all, as you said.
the only issue is to correctly supply field name.
as a fisrt step try:
- replace 'Title' with 'BMC_Description' in CAMLViewFields definition
- replace 'ows_Title' with 'ows_BMC_Description' in response processing function
So I tried som other columns and all seem to work except the column I need... thanks murphy! Recreated the column and boom, it's working. Sadly I have no idea what was wrong with it though...