filter dropdown on new form based on input

Home Forums SPJS-Utility filter dropdown on new form based on input

Viewing 1 reply thread
  • Author
    Posts
    • #18941
      Jeff Lynch
      Participant

        I have a need to do a filter on a dropdown based on two columns so I can’t use a cascade and have to use a SPFilterDropdown, but it’s based on an input in the form, and since that’s not set when we open the “new” form we don’t get any values. Basically getFieldValue doesn’t update on change.

        How can I make getFieldValue update on change in my function?

        The scenario here is I need to select location(s) based on the Account and on the Type of Location. I pre-populate the Account based on the vLookup, but the user must select the type when they open the new item.

        Is there a way to do this?

      • #18969
        Alexander Bautz
        Keymaster

          Sorry for the lat reply.

          I’m not familiar with the SPFilterDropdown function, but guess you can wait to call this function until you have your filter fields filled in. Wrap it in a function and call it from a “change” rule on your field – something like this:

          function callMeFromChangeTrigger(){
          	var theFilterValue = getFieldValue("YourFilterFieldName");
          	$().SPServices.SPFilterDropdown({
          		relationshipList: "Countries",
          		relationshipListColumn: "Title",
          		columnName: "Country",
          		CAMLQuery: "<Eq><FieldRef Name='YourFilterField' /><Value Type='Text'>"+theFilterValue+"</Value></Eq>",
          		completefunc: null,
          		debug: false
          	});
          }

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.