Click here to Skip to main content
14,142,500 members
Rate this:
Please Sign up or sign in to vote.
I am creating projects through sharepoint list and in the newform i have a fields which of type lookup. based on the selected value of lookup field the other lookup fields values has to be populated.

Ex: L1 has values a,b,c,d
L2 has values 1,2,3,4,5,6
if i select the L1 values as 'a' then L2 should display only 1,2.
if i select the L2 value as 'b' then L2 should display only 3,4.. so..on.

Please suggest how can it be done with minimal customization like JavaScript..

Thanks in advance!!
Sinisa Hajnal 1-Feb-16 11:56am
Create lookup column in your L2 that references L1.

Register onchange event for L1 and filter L2 according to selected value.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Here is simplified sample (you need jQuery for this, but it can be done without):
	$(document).ready(function () { 
	// hide source if BranchAmbassador not selected	
		var $source = $("select[id^='InitiativeSource']");
// this is your selected L1		
		var $selected = $("select[id^='InitiativeSource'] option:selected");

	function sourceChanged() {
		var $selected = $("select[id^='InitiativeSource'] option:selected");
		if ($selected== null || $selected.val() != 1) {
// here you filter L2 to what you need based on $selected.val()
// create collection from your list items and filter them based on this value

	} // end sourceChanged

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 1 Feb 2016
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100