Control: Multi-control

 Show all Hide all

This field type inserts the controls specified by an sql query into the normal flow of controls on the page.

Start value: Value that is passed to the stored procedure specified in the Sql field as the parameter @id. It is also passed to the insert / update procedure of the newedit.aspx page.
Return value: Two modes are supported:

In the temp table mode all data from the controls is passed to a temporary table. The start value is returned to the insert / Update procedure. The name of the temporary table is also passed to the insert update procedure in a parameter called <fieldname>TableName. The temporary table always has the columns Id and Value, both nvarchar. If the multi-control contains controls that provide extra parameters such as the file control, the parameters are added as columns with the same names to the temp table.

In the classic mode a '¤' separated list of values is passed as a parameter.

Control container: NewEdit

Supported in: NewEdit


SQL Call: Control specifications (mandatory)

Return one row for each control to insert.
Supports custom errors: No
May modify database: No


@id mandatory string
Value supplied from the database record being edited or default value of the field depending on the action parameer to newedit.aspx.

Resultset: Control specifications

Return field information for the controls to insert.
Repeat mode: repeated exactly once
Row count: zero or more rows


<other> optional string
You may also specify any other field information supported by the fieldtype. If it is not supported by all controls in the resultset it should be set to null for the controls that don't support it. See documentation for the control type in question for information on what additional options may be specified.
ButtonJavaScript<xxx> optional string
Inserts a button next to the control that is used to execute the JavaScript supplied here. <xxx> is an arbitrary text that can be empty if only one button is required.
ButtonJavaScript<xxx>_Label optional string
The label for the JavaScript button <xxx>.
defaultvalue mandatory string
Default value for field. Can contain other fields for value dependency.
DefaultValueSql optional bigint
SQL that evaluates default value for field. Can contain other fields for value dependency.
description optional string
Description for the control.
enabledjavascript optional string
Javascript that controls whether the control is enabled for edit. The value of a disabled field is always NULL.
FieldInfoId optional int
ID of field information to base the dynamic field on. All properties not explicitly overridden by dynamic field information will be copied from this field. The referenced field must be found in the menu item's field tables.
fieldlabel optional string
Label for the control
fieldname optional string
The name of the field if referring to it from other controls.You should avoid using special characters in the fieldname column. If you need to pass complex data to the insert/update procedure then use the id-column instead.
fieldtype optional string
The type of control to create.
Possible value Description
boolean checkbox
boolean dropdown
textbox with dropdown
textbox with popup
uneditable text
height optional int
The height of the control.
id optional string
A custom id value identifying this control. This is passed back as the column Id if the temporary table mode is used.
nullchoice optional bit
Specify 1 to allow null values or 0 to disallow null values.
onchangejavascript optional string
Javascript to run when the value of the control has changed.
Placeholder optional string
Text shown when the field is empty.
sql optional string
Sql for the control.
value optional string
Start value of the control. Only applicable in edit and duplicate modes. In new mode the default value is used as start value.
width optional int
The width of the control.
visiblejavascript optional string
Javascript that determines when the control is visible. Supports references to other controls.


Multicontrol procedure

Example multicontrol procedure. In the example an input field per row in MultiControlTable will be created and if there is a corresponding value in MultiControlTable it will populate the field.

The [FieldName] column is only needed if you have dependencies.

CREATE PROCEDURE Example.MultiControlTable_MultiControl
	@Id		int = NULL

		-- Name that can be used to reference the field in visibility, defaultvalue and SQL fields
		'MultiControlTable' + CONVERT(varchar(100), MCTT.MultiControlTableTypeId) AS [FieldName],
		MCTT.MultiControlTableTypeName AS [FieldLabel],
		-- Id value passed to InsertUpdate procedure in Id column to identify value
		MCTT.MultiControlTableTypeId AS [Id],
		-- Use "SQL: " an in regular field info to run a SQL statement
		MCTT.CanAllowNullValues AS [NullChoice],
		-- The different field types in Softadmin are valid choices
			WHEN MCTT.IsDropdown = 1 THEN
			WHEN MCTT.IsHeading = 1 THEN
			WHEN MCTT.IsTextbox = 1 THEN
		END AS [FieldType],
		-- SQL statement for field types that require it
		-- Visibility field
			WHEN MCTT.MultiControlTableTypeId = 4 THEN
		END AS [VisibleJavascript]
		-- One field per row in Example.MultiControlTableType
		Example.MultiControlTableType MCTT
		-- Get value from Example.MultiControlTable if it exists
		LEFT JOIN Example.MultiControlTable MCT ON
			MCT.MultiControlTableTypeId = MCTT.MultiControlTableTypeId AND
			MCT.RowId = @Id


Best practice

Name of stored procedure

The stored procedure should be named "<Schema>.<TableMultiControlGetsRowsFrom>_MultiControl".