To select multiple values from checkboxes or a list field and have them appear as individual database entries, use the following code in the Add page: Before Record Added event.
if (values["fieldname"])
{
var arr = MVCFunctions.explode(",", values["fieldname"]);
// This is the name of the multi check box or
// list select field, its value becomes arr
for (int i = 0; i < arr.Count(); i++)
{
var strInsert = String.Format("insert into TableName (field) values ('{0}')", arr[i]);
// add more fields from the add page to be inserted into database
DB.Exec(strInsert, GlobalVars.conn);
}
// Exit and Redirect to the list page after updating database
MVCFunctions.HeaderRedirect("tablename", "list");
}
See also:
•JavaScript API:getSelectedRecordKeys()