Ajax.InPlaceSelect

January 6, 2009
Download

Description

Creates a select control in place of the html element with the id specified.  It functions similar to Ajax.InPlaceEditor but instead of an input control, it creates a select control with a list of options from which to choose. The parameters ‘values’ and ‘labels’ are arrays (of the same length) from which the options are defined.

I took the liberty to update InPlaceSelect class for scriptaculous since I felt some features where missing.

  • Added option “okButton” (default true)
  • Added option “okText” (default ‘ok’)
  • Added option “cancelText” (default ‘cancel’)
  • Added option to take use of the onChange method or not. (default false)
  • Added support for multi choice selects
  • Added option “multiSelect” (default false)
  • Added option “multiDelimiter” (default ‘<br>’)

Previous version available here

Demo

View simple demo here

Did you like this article?

  • James
    If I were to be using that JS in a function so that I could load several of the select lists on one page.. when I click cancel on a list that has loaded.. if I then go back to re-edit that same one.. the original ones also appears
    (so the first menu etc is not being removed and the new menu is being added to it..

    Any ideas anyone?

    function is as follows:

    function addnewselect(CategoryID) {
    var editor = new Ajax.InPlaceSelect('details_defaultnominal_' + CategoryID, 'includes/inc_editinplace_process.asp', [], [], {callback: function(value,text) { return 'UpdateFieldName=NominalCode&UpdateTblName=Suppliers_Products_Categories&UpdateUniqueIDName=CategoryID&UpdateUniqueID=' +CategoryID +'&UpdateValue='+escape(value)}, cancelControl:'button', highlightcolor: '#F5F5F5'
    });
    }

    I've tried all combinations on the onCancel: event as you can for the InPlaceEditor without success...
  • Please also let me know if you do come across the solution for this. I have tried as well but in vain.
blog comments powered by Disqus