PHP Classes

Moving List: Create select inputs and move items between them

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 59%Total: 2,236 All time: 1,743 This week: 673Up
Version License Categories
cmovinglist 1.0GNU General Publi...Content management


This class is meant to assist in the creation of forms with pairs of multiple select inputs with buttons to move options between each of the select inputs.

This is useful to manage lists of values that are made of a limited set of known options.

The class does not generate the form inputs. It just generates the necessary Javascript code to associate to onclick events of form buttons that remove options from one select input and add them to the other.

Innovation Award
PHP Programming Innovation award nominee
March 2004
Number 4

Prize: One copy of the Zend Studio by Zend
Some times Web developers have solve the problem of building a list made of items that exist on another list.

For instance, if you want to classify an article for publication that may belong to multiple categories, once you associate the article to a given category, the category will move from the list of possible categories to the list of categories already associated with the article. If you want to remove the association of an article with a category, the opposite list movement needs to be executed.

The problem of implementing movements of items between two lists in a Web application is that the Web controls provided by common HTML forms do not provide an easy way to implement this kind of dynamic user interface manipulation.

The solution provided by this class is to generate Javascript code that can move items between two lists defined with multiple select inputs. The generated Javascript code can be associated to the onclick events of additional control buttons.

Although this solution could be implemented without the need to resort to Javascript, it would require additional form submissions to update the state of the lists, thus making the Web forms less usable.

Manuel Lemos
Picture of Filippo Toso
Name: Filippo Toso <contact>
Classes: 20 packages by
Country: Italy Italy
Age: 44
All time rank: 151 in Italy Italy
Week rank: 44 Down1 in Italy Italy Equal
Innovation award
Innovation award
Nominee: 5x

  Files folder image Files  
File Role Description
Plain text file CMovingList.php Class Class file
Accessible without login Plain text file sample.php Example Sample script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,743
This week:673Up
 User Ratings  
 All time