Posts

Showing posts with the label lookup

SharePoint 2010 - Simple Cascading Lookup with SPServices

Image
A new post on that excellent tool that is SPServices, the jQuery framework / EcmaScript for SharePoint! A simple scenario: we have two lists of data, for example, Countries and Companies for Countries, and a list which has two columns Lookup, Country and Company. We want to be able to use the first Lookup, Country, to filter second, Company, showing Companies for the selected Country. We create the list Nations, with only the Title field. Now let's create Companies with Title (Company Name) and Country (lookup list to the Nations). Now, let's create a list CustomList1 that has the two columns Country and Company, respectively lookup of Nations and Companies. We modify the NewForm.aspx and EditForm.aspx form by entering the following code, making sure to load the SiteAssets. Js file we need: jquery.SPServices-0.7.2.min.js ( download here ) jquery-1.8.2.min.js (tested with this version) Here's the code to insert in both forms (new and edit): <sc...

SharePoint 2010 - Semplice Cascading Lookup con SPServices

Image
Ancora un post su quell'ottimo strumento che è SPServices, il framework jQuery/Ecmascript per SharePoint! Uno scenario semplice: abbiamo due liste di anagrafiche, ad esempio, Nazioni e Aziende per Nazioni, e una lista che ha le due colonne Lookup, Nazione e Azienda. Vogliamo poter utilizzare la prima Lookup, Nazione, per filtrare la seconda, Azienda, per le sole Aziende per il Paese selezionato. Creiamo la lista Nazioni, con il solo campo Title. Ora creiamo la lista Aziende con Title (Nome Azienda) e Nazione (lookup verso la lista Nazioni). Ora, creiamo una lista CustomList1 che abbia le due colonne Nazione e Azienda, rispettivamente lookup di Nazioni e Aziende. Modifichiamo i form NewForm.aspx e EditForm.aspx, inserendo il codice che segue, avendo cura di caricare in SiteAssets i file .js di cui abbiamo bisogno: jquery.SPServices-0.7.2.min.js ( download qui ) jquery-1.8.2.min.js (testato con questa versione) Ecco il codice da inserire in entrambi i form (n...

Sharepoint 2007 - When use Lookup Columns instead Choice Columns

Image
There are a number of ways to store options for a field that requires a group of pre-selected options, a drop down list as it were. I always thought that defining a column of the type choice is the way to go but recently discovered that in a couple of areas that creating a list and then using that as a look up is actually a better solution. When to use a Choice Column You should use a choice column, pictured below, in the following circumstances: 1) Only site administrators should be able to add/remove/edit options 2) You don’t have that many options to choose from (maximum ten) and users will usually only select at most 5 options. 3) The options rarely change This is the usual way to go in a SharePoint environment but it can cause many issues. For starters a choice column can only store 255 characters (SharePoint in built field limit) so if your users are choosing 10 options each of 26 characters (see below) then they wont be able to. This is because the choice fied...