Dynamic Dropdown Plugin

About
For years I've been using my own small customization to add drop down control to pages. I used it for cities, states, salutations, etc. After my list grew too large I customized it again to more manageable and a single page. This plugin attempts to do a very similar task to Dean's customization from 2008 (yeah, 2008, I checked). It adds a single link on the district menu to a page that helps manage your drop downs. What's more, you can enter in drop downs that already exist and they'll show up as well.

What's New

  1. Added logic for when the category is studentscrenn

Directions

  1. Switch to District Office if you aren't already there
  2. Click on District from the left menu
  3. Click on Custom Drop Down Lists
  4. The page will be blank until you select a list to work on. If this is your first time in you'll only have the Drop Down Types list available. Select a list
  5. Click New to add a new record to the list or click the list item to change values.

Adding a new list

  1. Navigate to the Custom Drop Down Lists
  2. Select Drop Down Types
  3. Click New
  4. Enter a plural and a singular label (ex: Cities and City) so that the display is correct and in context.
  5. Enter a unique value in the Value box. This can be something that is already in use if you wish to show an existing list (ex: entrycodes) or a new category. The value here is what will be used in the gen.cat field for the list.
  6. If you want your lists to appear in a certain order then you can use the Sort Order field. Otherwise leave it at 99 and they will sort by the value column.

Note: Deleting a list from the Drop Down Types menu does not delete all the actual records from the gen table. It only removes it from being managed in this customization.

Managing a list

  1. Navigate to the Custom Drop Down Lists
  2. Select the list you wish to work on
  3. To add an item to the drop down click New. You will need to add a label (ex: New York) and a value you want recorded when users select that option (ex: NY). If sorting is important change the sort order.
  4. To edit an existing item click on the item and change the values. Just note that changing the value of the item does not retroactively change the records that item was used on.

Using your new list
This customization provides a tool to manage lists for drop downs. However once you have a list created its up to you to customize your page to use that list. There are a few ways of doing this from using the same tags as the entry/exit code drop downs and changing the special to writing a query to populate the values to using a tlist and jQuery to create your drop down. There are many ways to use your list but for here I'll only list the easiest, reusing the entrycodes drop down (these are just directions, I can not support you if you have trouble getting it to work but I will update the directions if you find they are wrong)
Method 1: list appears as name (value)

  1. Find the field you wish to turn into a drop down. If the field already exists on a page it's likely in a text box.
  2. Start your drop down by creating a select. I like to set the id to be the same thing as the name without the table reference (so if name="[01]entrycode" then id="entrycode")
  3. In your select tag add the code special="lists.entrycodes" but change entrycodes to your list. This was the unique value entered when setting up your list.
  4. Close your select if you haven't already.
  5. If replacing an existing text box remove that too.
  6. Pearson adds in a single option tag. If you choose to do that too (with no value) please close it. They drive me crazy when they are left open (as all of Pearson's are).
  7. Save your page

Method 2: list appears as just the name while recording the value

  1. Follow the steps from method 1 but use a different special
  2. special="lists.custom;name=citie;table=gen;*cat=city;namefld=Name;valuefld=value;sortfld=name"
  3. name=citie is the plural name you want the list to show (minus the s because the special will append it)
  4. *cat=city -> change city to your list value
  5. sortfld=name -> how do you want to sort your list. Using name will sort alphabetically. You can also sort by sortorder field if you used that to create a specific sort

For examples go to [your powerschool server]/admin/students/edittransfer1.htmlt in any browser other than Internet Exploder and you'll see the code and several examples. selectEntryCode, selectExitCode, selectDistOfResidence are the closest to what we are doing in the example above.

With so many options, where should I start
Wihtout a doubt I would start with cities. How can you get correct data if people enter the same city different ways? Take New York City for example. You might find it NYC, New York City, NY City, etc. Next I'd say was states but I found there is a way to do states built in (special="states.usstates") so if you are in the US don't bother making a states drop down list, let Pearson control it.

Customization:

Contributor: 
Jason Treadwell

PS Verions

7.x: 
Y
8.x: 
Y
9.x: 
Y
10.x: 
Y
Plugin: 
Y
CPM Import Friendly: 
Y
Images: 
The initial screen for the customization
Initially only Drop Down Types is available
List of drop downs being managed
All managed drop downs appear in the master drop down list
Example of a managed list

Comments

Hi Jason, thanks for the great plugin, this will save me hours of repetitive jquery and html coding! Method 1 worked for me straight up, but I can't get Method 2 to find any values from the same list. My custom dropdown list has the following settings:

Custom Drop Down = Relationships
Label - Singular = Relationship
Value = relationships
Sort Order = 99

My list items have the same description and value, for example Father and Father, Mother and Mother, etc

The following html in my fragment works fine:

<select name='[Students.U_STUDENTS_EXTENSION]ACS_STU_ADULT_A_RELATION' id='ACS_STU_ADULT_A_RELATION' special="lists.relationships" value=''/>

and my drop displays:

Father (Father)
Mother (Mother)
etc

I just want to show the description and not the value, so I'm trying method 2 as follows:

<select name='[Students.U_STUDENTS_EXTENSION]ACS_STU_ADULT_B_RELATION' id='ACS_STU_ADULT_B_RELATION' special="lists.custom;name=relationship;table=gen;*cat=relationships=;namefld=name;valuefld=value;sortfld=name"/>

The results in my dropdown is:
[No relationships found]

I have tried varies combinations of relationship and relationships in name and *cat, and I've tried Relationship and Relationships, but I get the same thing.

Any assistance on the correct syntax would be appreciated.

Ade

Was there a syntax solution to the previous question showing just description and not value in drop down?

Subscribe to Comments for "Dynamic Dropdown Plugin"