Skip to main content
added 64 characters in body
Source Link
Eric Alexander
  • 43.3k
  • 10
  • 54
  • 93

I'm using Marc's SPServices jQuery library - the SPFilterDropDown script - to filter the items in a Lookup multi-select field on a New Item DVWP. It works fine if I stick some static text in there - but I'd like it to be dynamic.

I've tried a few versions.

var VARIABLE = $("#VARIABLE").html(); $(document).ready(function() { $().SPServices.SPFilterDropdown({
relationshipList: "{LISTID}",
relationshipListColumn: "COLUMN",
columnName: "FORMCOLUMN",
listName: "{LISTID}",
noneText: "(None)",
CAMLQuery: "'+ VARIABLE + '",
completefunc: null,
debug: true });

var VARIABLE = $("#VARIABLE").html();
$(document).ready(function() {
$().SPServices.SPFilterDropdown({  
relationshipList: "{LISTID}",  
relationshipListColumn: "COLUMN",  
columnName: "FORMCOLUMN",  
listName: "{LISTID}",  
noneText: "(None)",  
CAMLQuery: "<Eq><FieldRef Name='VARIABLE' /><Value Type='Text'>'+ VARIABLE + '</Value></Eq>",  
completefunc: null,  
debug: true
});

The //var VARIABLE = $("#VARIABLE").html();////var VARIABLE = $("#VARIABLE").html();// line is my attempt at making the dynamic piece work.

I've tried many variations on the CAML query:

  • '+ VARIABLE + ' vs. {VARIABLE}
  • Value Type='Text' vs. Value Type='Lookup'
  • Eq vs. Contains
- '+ VARIABLE + ' vs. {VARIABLE}
- Value Type='Text' vs. Value Type='Lookup'
- Eq vs. Contains

No luck. Looking for help.

I'm using Marc's SPServices jQuery library - the SPFilterDropDown script - to filter the items in a Lookup multi-select field on a New Item DVWP. It works fine if I stick some static text in there - but I'd like it to be dynamic.

I've tried a few versions.

var VARIABLE = $("#VARIABLE").html(); $(document).ready(function() { $().SPServices.SPFilterDropdown({
relationshipList: "{LISTID}",
relationshipListColumn: "COLUMN",
columnName: "FORMCOLUMN",
listName: "{LISTID}",
noneText: "(None)",
CAMLQuery: "'+ VARIABLE + '",
completefunc: null,
debug: true });

The //var VARIABLE = $("#VARIABLE").html();// line is my attempt at making the dynamic piece work.

I've tried many variations on the CAML query:

  • '+ VARIABLE + ' vs. {VARIABLE}
  • Value Type='Text' vs. Value Type='Lookup'
  • Eq vs. Contains

No luck. Looking for help.

I'm using Marc's SPServices jQuery library - the SPFilterDropDown script - to filter the items in a Lookup multi-select field on a New Item DVWP. It works fine if I stick some static text in there - but I'd like it to be dynamic.

I've tried a few versions.

var VARIABLE = $("#VARIABLE").html();
$(document).ready(function() {
$().SPServices.SPFilterDropdown({  
relationshipList: "{LISTID}",  
relationshipListColumn: "COLUMN",  
columnName: "FORMCOLUMN",  
listName: "{LISTID}",  
noneText: "(None)",  
CAMLQuery: "<Eq><FieldRef Name='VARIABLE' /><Value Type='Text'>'+ VARIABLE + '</Value></Eq>",  
completefunc: null,  
debug: true
});

The //var VARIABLE = $("#VARIABLE").html();// line is my attempt at making the dynamic piece work.

I've tried many variations on the CAML query:

- '+ VARIABLE + ' vs. {VARIABLE}
- Value Type='Text' vs. Value Type='Lookup'
- Eq vs. Contains

No luck. Looking for help.

Source Link
Cory M
  • 354
  • 1
  • 6
  • 15

How can I pass a Query String variable into the CAML of a jQuery script?

I'm using Marc's SPServices jQuery library - the SPFilterDropDown script - to filter the items in a Lookup multi-select field on a New Item DVWP. It works fine if I stick some static text in there - but I'd like it to be dynamic.

I've tried a few versions.

var VARIABLE = $("#VARIABLE").html(); $(document).ready(function() { $().SPServices.SPFilterDropdown({
relationshipList: "{LISTID}",
relationshipListColumn: "COLUMN",
columnName: "FORMCOLUMN",
listName: "{LISTID}",
noneText: "(None)",
CAMLQuery: "'+ VARIABLE + '",
completefunc: null,
debug: true });

The //var VARIABLE = $("#VARIABLE").html();// line is my attempt at making the dynamic piece work.

I've tried many variations on the CAML query:

  • '+ VARIABLE + ' vs. {VARIABLE}
  • Value Type='Text' vs. Value Type='Lookup'
  • Eq vs. Contains

No luck. Looking for help.