filter dropdown on new form based on input
- This topic has 1 reply, 2 voices, and was last updated 8 years, 11 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Home › Forums › SPJS-Utility › filter dropdown on new form based on input
Tagged: update column on change
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?
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