locked
SharePoint Form Customization (Dynamic Checkbox options) RRS feed

  • Question

  • Hi,

    I created a main list that contains drop downs and checkboxes. The requirement is to make the options available for the checkboxes dynamic based on the selection of the drop down. The relationship between the which checkbox options should appear for which drop down is defined in another list (example below). Can I accomplish this using javascript/jquery on the newform and editform?

    Thanks.

    DropDown         CheckBox Options

    DD1                   CHK1
    DD1                   CHK2
    DD1                   CHK3
    DD2                   CHK4
    DD2                   CHK5

    Friday, July 6, 2012 5:40 PM

Answers

  • Is the "PeopleNames" column a sharepoint "people/group" type field? I don't know if the script is compatible for that type of fields. I'd suggest posting this to the forum of SPServices.


    Pman
    http://www.pmansLab.com/

    Wednesday, July 11, 2012 1:01 AM

All replies

  • >> Can I accomplish this using javascript/jquery on the newform and editform?

    Short answer is yes, you can. Have you tried it already?


    Pman
    http://www.pmansLab.com/

    Saturday, July 7, 2012 7:57 PM
  • Parvez,

    I downloaded spcd.js from 'http://spcd.codeplex.com/releases/view/40417'. I then inserted the javascript below in the editform page using a content editor web part.

    <script type="text/javascript">   

    var ccd1 = new cascadeDropdowns("Release", "Feature Category", "Release_Lookup", "Feature_Lookup", "Title");

    </script>

    This works for cascading drop downs as long as the number of items in the drop down does not exceed 20. Not sure how I can customize this for checkboxes. Any help is great.

    Thanks.

    Sunday, July 8, 2012 4:32 PM
  • Ahh... Looks like you're trying to implement Cascaded DropDown feature. I didn't realize that because the second column in your example was showing checkbox instead of a drop down field. Cascaded DropDown involves multiple drop down fields.

    Anyways, that script obviously doesn't support if you have more than 20 fields, in which case SharePoint doesn't use a traditional HTML drop down field. Try the SPServices. I've used this library and it has a lot of great features/functions. This one will support your cascaded dropdown even if it exceeds more than 20 items.

    http://spservices.codeplex.com/


    Pman
    http://www.pmansLab.com/


    Monday, July 9, 2012 1:51 AM
  • I tried using SPService. I setup list relationships and tried using the code below. It works great if I only use 'SPCascadeDropdowns' once in the .ready(function). If I use it a second time for 'PeopleNames' as shown below even the 'Regions' cascading does not work. Is there something I am missing?

    Thanks.

    <script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.4.2.js"></script>
    <script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery.SPServices-0.5.7.min.js"></script>
    <script language="javascript" type="text/javascript">
    	$(document).ready(function() {
    		$().SPServices.SPCascadeDropdowns({
    			relationshipList: "Regions",
    			relationshipListParentColumn: "Country",
    			relationshipListChildColumn: "Title",
    			parentColumn: "Country",
    			childColumn: "Region",
    			debug: true
    		});
    		$().SPServices.SPCascadeDropdowns({
    			relationshipList: "PeopleNames",
    			relationshipListParentColumn: "Name",
    			relationshipListChildColumn: "Title",
    			parentColumn: "Person",
    			childColumn: "Contracts"
    		});
    	});
    </script>
    Monday, July 9, 2012 2:35 PM
  • Is the "PeopleNames" column a sharepoint "people/group" type field? I don't know if the script is compatible for that type of fields. I'd suggest posting this to the forum of SPServices.


    Pman
    http://www.pmansLab.com/

    Wednesday, July 11, 2012 1:01 AM
  • Thanks.. will look into that.
    Monday, July 16, 2012 9:08 PM