This project has moved and is read-only. For the latest updates, please go here.

Fill Textbox Value with SPAutoComplete then Use that Value to GetListItems to populate other TextBox

Oct 3, 2013 at 10:18 PM
I am in a bit of a quandary. I am currently using SPAutoComplete to reach out and get a value from a list which is working fine. Then I am attempting to use that SPAutoComplete value once you tab or click out to grab the relevant row from the same list via GetListItems. Then to shove those values into the TextBoxes on the form.

The SPAutoComplete is working just fine, however I cannot get the GetListItems to work at all with the value from the textbox after the value is entered.

Here is an example of my code :

$(document).ready(function() {

  operation: "GetListItems",
  async: false,
  listName: "Store List",
  CAMLQuery: "<Query><Where><Eq><FieldRef Name='Store_x0020_Number'/><Value Type='Text'>" + $("input[title=Store Number]").val() + "</Value></Eq></Where></Query>",
  completefunc: function (xData, Status) {
    $(xData.responseXML).find("[nodeName='z:row']").each(function() {
I know GetListItems is working as I can use the basic example shown on the documentation to show the data in an list. However I have to "hardcode" the store number value in lieu of the variable.

Any help would be greatly appreciated!
Oct 4, 2013 at 12:55 AM
I think the problem is:
$("input[title=Store Number]")
When using attribute matching selectors the value of the attribute needs to be quoted.  Try this to see it this works:
$("input[title='Store Number']")
If that does not work, capatize the 't' in 'title'. 
Another side note: you are still using the old way of finding z:row's.  This might be ok depending in the versions of SPServices and jQuery.  See the main page for info. 

Sent from mobile.


Paul T