Field types
Field types in edit and template settings forms
The definition of field is partially in schema.json (data definition) and partially in options.json (ui definition)
Text
schema type : string
options type : text
more info
"type":"string",
"title":"my field name"
"type":"text",
"helper" : "my helper tooltip"
- You can use a Pattern as for validation. This is Alpaca functionality but as the regex is stored in JSON you will need to escape a slashes or you will get an error.
"type":"string",
"title":"my field name",
"pattern": "[\\d\\s]+"
Dropdown
schema type : string, (and array for checkbox list in dropdown)
options type : select
more info
"type":"string",
"enum": ["Vanilla", "Chocolate", "Coffee", "Strawberry", "Mint"]
"type": "select",
"optionLabels": ["Vanille", "Chocolat", "Café", "Fraise", "Comme"],
"removeDefaultNone": true
Select2 (advanced)
schema type : string, (and array for checkbox list in dropdown)
options type : select2
Select2 is a dropdown that can get his items from a webapi call thu serviceFramemork
see Select2 for more detailed information.
Radio buttons
schema type : string, number
options type : radio
more info
Checkbox
schema type : boolean (and array for checkbox list)
options type : checkbox
more info
Url
(textbox with auto complete search in dnn pages, results in a url-string)
schema type : string
options type : url
dnn specific
Url2
(textbox with auto complete search in dnn pages, results in a tabid)
schema type : string
options type : url2
dnn specific
Email
schema type : string
options type : email
more info
Date / Time
schema type : string
options type : date
options : "dateformat": "DD-MM-YYYY" (or any other .NET date time format)
Image fields
see subpage
File (with instant upload and auto complete search)
schema type : string
options type : file
Uploaded files are stored in : /Portals/[portalid]/OpenContent/Files
"File": {
"type": "file",
"helper": "Url of the file",
"typeahead": {
"Folder": "Files"
},
"uploadfolder" : "Files",
"downloadButton":true
}
File2 (based on select2)
"File": {
"type": "file2",
"filter":"^.*\.(jpg|JPG|gif|GIF|doc|DOC|pdf|PDF)$",
"folder":"Files",
"showFileUpload":true,
"showUrlUpload":true
}
Folder2 (based on select2)
"Folder": {
"type": "folder2",
"filter":"",
"folder":"Files"
}
Textarea
schema type : string
options type : textarea
more info
Rich text with CKEditor
( CKEditor http://ckeditor.com )
schema type : string
options type : ckeditor
configset: basic, standard, full. (basic is default. standard includes div and table support. full allows any code)
dnn specific
require dnnckeditor (https://dnnckeditor.codeplex.com)
{
"fields": {
"CKEditor1": {
"title": "CkEditor With Style Set",
"type": "ckeditor",
"ckeditor":{
"extraAllowedContent": "table tr th td div span(*);",
"stylesSet" : [
{ "name": "Blue Title", "element": "h3","styles": { "color": "Blue" } },
{ "name": "Red Title", "element": "h3","styles": { "color": "Red" } }
]
}
}
}
}
{
"type": "object",
"properties": {
"Title": {
"title": "Title",
"type": "string"
},
"CKEditor1": {
"title": "Text",
"type": "string"
}
}
}
<h2>{{Title}}</h2>
<hr>
{{{CKEditor1}}}
more info about ckeditor config
From version 4.2 with configset=full there possibility to add image
Rich text with Wysihtml
(wysihtml http://wysihtml.com)
schema type : string
options type : wysihtml
dnn specific
Rich Text with Summernote
The Summernote editor is a very compact WYSIWYG editor.
An important characteristic of this editor is that it will not upload images to the server but it will inject them Base-64 encoded inside the text.
So you should probably not use this editor for large images inside a text.
{
"type": "object",
"properties": {
"ModuleTitle": {
"title": "Main Title",
"type": "string"
},
"Text": {
"title": "Text",
"type": "string"
}
}
}
{
"fields": {
"ModuleTitle": {
"type":"text"
},
"Text": {
"title": "Text",
"type": "summernote"
}
}
}
List of items
schema type : array
options type : array
more info
Table of items
schema type : array
options type : table
more info
Accordion
schema type : array
options type : accordion
titleField : a fieldname of the items shows in the accoreon used as title of the accordeon
"myfield": {
"type": "accordion",
"titleField": "fieldname"
}
inherit from array more info on array
Dependency between fields
Dependencies
Conditional Dependencies
Multi-Lingual Field types
To support multi-lingual scenario's you can use the ML variant of certain fields.
In doing so you will be presented with the possibility to add the content in the different activated languages (even if content localization is still disabled)
Currently the following field types have a multi-lingual variant:
Multi lingual Text
schema type : string
options type : mltext
"ProductName": {
"title": "Product name",
"type": "mltext"
}
Multi lingual CKeditor
schema type : string
options type : mlckeditor
Multi lingual wysihtml
schema type : string
options type : mlwysihtml
Multi lingual url
schema type : string
options type : mlurl
Multi lingual Image
schema type : string
options type : mlimage
Multi lingual File
schema type : string
options type : mlfile
Icon Field
schema type : string
options type : icon
"Icon": {
"title": "Icon",
"type": "string"
}
"Icon": {
"type": "icon",
"glyphicons" : false,
"fontawesome" : true
}
User2 Field
"User": {
"title": "User",
"type": "string"
}
"User": {
"type": "user2",
"lazyLoading" : false,
"role" : "Editor"
}
role : filter users on role
Note: If you need to select multiple roles, in schema.json, set "type": "array"
.
Updated about 6 years ago