1

I'm using SPFilterDropdown in a NewForm for a drop-down list which will be huge. I'm using the cascaded dropdown function (SPCascadeDropdowns) to reduce the size but I'd also like to filter the list further by using a value from another column.

The trouble is that the example supplied comes with a hard-coded value in the CAML query. I'd like to use the value selected by the user from a drop-down column in the same NewForm.

$().SPServices.SPFilterDropdown({
      relationshipList: "Countries",
      relationshipListColumn: "Title",
      columnName: "Country",
      CAMLQuery: "<Eq><FieldRef Name='Active' /><Value Type='Boolean'>1</Value></Eq>",
      completefunc: null,
      debug: false

So I know what value will have FieldRef, it's just how to reference the value from the drop-down that will be used in the Value tag?

Thanks,

0

You need to add code before you use the SPFilterDropdown method to find out what the value in the dropdown is. You can use JQuery to get the value of the dropdown and store it in a variable. Then use that variable in the CAML query.

  • So, I think I need to use the GetListItems function? If that is the case then can I use it in this screen for a record that hasn't been stored yet? I'm thinking that I'd have to use something like <br/> 'var SR_var = ($(this).attr("ows_Title")):' <br/>But then how would this variable (SR_var) be used in the value tag of SPfilterDropdown? – Anthony Horner Sep 19 '16 at 8:30
  • Aaah used up the five minutes trying to format!! – Anthony Horner Sep 19 '16 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.