quarta-feira, 7 de agosto de 2013

Delphi with jQuery UI Multiselect component

POST #022 =======================================================================
I would like to submit an array of strings from a web form to Delphi mORMot server through GET request.
Suppose you have a multi select jQuery UI control which allows users to select items, you would like to save the multi selected items to a database. When the page is next loaded you want to retrieve the list of items from a remote data source but also set the currently selected items.

I suspect that there is a clever way to do this in mORMot, but here I'm using another alternative approach to pass json encoded array into URL via GET method. My mORMot service I've written seems fine with having an array of strings as input using Delphi type "set with enumerations". The array will automatically be parsed by mORMot.
If you don’t know, ENUMERATIONS is simply a fixed range of named values. Each of the values in an enumeration must be unique in a program. It allows a variable to have one, and only one value from a fixed number of values. Otherwise, a SET is a collection of values of the same ordinal type. Sets allow you to have any combination of the given values - none, 1, some, or all. Sets with Enumerations is used to mix both enumerated types and set types. I know this might look complicated, but it really isn't!



Tags: jquery UI with delphi mORMot; Delphi mORMot UI Settings; Delphi jquery multi select list; Delphi REST server;

Warleyalex from Sete Lagoas-MG, Brazil