Input

The Input Class provides properties, methods, and events to interface with the HTML tags generated by the <silk:Input> tag.

Kind: global class

Properties

Name
Type
Description

columnID

String

The input's' unique identifier. This woudl be the name of the dataProvider coulumn if part of a Form tag.

$input

Object

The JQuery reference to the SILK Input HTML structure.

$filePreviewBt

Object

The JQuery reference to the preview button.

$fileDownloadBt

Object

The JQuery reference to the donwload button.

selectedIndex

Integer

The index of the last dataProvider's item in the case of types select and radio.

validation

function

Function to validate the entered value. The function parameters are: type and entered value.

loadFilter

funciton

Function to decide which item from dataSource should be loaded into a Select, radio, or options. Returns a boolean.

Methods and Event

new Input(id, type, label, options, initValue)

Returns an Input instance.

Param
Type
Default
Description

id

String

Unique identifier.

type

String

The input type: text, textarea, code, html, date, time, datetime, select, numeric, integer, decimal, checkbox, button, options, radio, password, file, email, hidden.

label

String

The text used as input's label.

options

Object

Object containing the Input configuration options.

initValue

String

The value which the Input will hold when created.

[options.columnID]

String

The dataSource column name if different from the id parameter.

[options.description]

String

The input's description only show at editing mode.

[options.width]

String

The width of the component in pixels or percentage.

[options.height]

String

200px

THe heigth of the component in case of the types: textarea, code, and html.

[options.scrollHeight]

String

The height limit of the component in read mode before the content needs scrolling.

[options.dataSource]

String

The dataProvider id in case of types: Select, options, and radio.

[options.required]

Boolean

false

The logic value or expression to determine if the component should be required before data submission.

[options.editable]

Boolean

true

The logic value or JavaScript expression to determine if the component should be visible.

[options.visible]

Boolean

true

Expression to evaluate if the component should be visible.

[options.maxLength]

Integer

The number of characters the input will allow.

[options.name]

String

The "name" of the input if used under a regularhtml tag.

[options.scriptValue]

String

Javascript expression returning the input's value.

[options.scope]

String

1

The component end target. Check the setScope() method for values.

[options.mask]

String

The input's entry mask or character filter. (http://igorescobar.github.io/jQuery-Mask-Plugin/)

[options.mode]

Boolean

false

True if editing, or false if read only.

[options.placeholder]

String

The input's place holder or helping text showed inside the

[options.form]

String

The Form ID the input will operate with.

[options.block]

Boolean

false

If the component is the end of a block. Next Inputs will start in a new line.

[options.cssClass]

String

The extra CSS classes to use with the input element.

[options.inputClass]

String

Extra CSS classes affecting the component.

[options.valueColumn]

String

Indicates the dataProvider's column containing the value to use in select, options, and radio.

[options.labelColumn]

String

label

Indicates the dataProvider's column containing the label to use in select, options, and radio.

[options.linkColumns]

String

Indicates the dataProvider's columns which will be updated in the dataSource. To use in select, options,and radio.

[options.template]

String

A HTML schema defining the component read view.

[options.target]

String

The HTML element in which the component will be rendered.

[options.extraProperties]

String

To add extra HTML properties to the

[options.htmlConfigFile]

String

/ckeditor-conf/bar-simple.js

The JavaScript file containing the custom configuration for CKEditor. To be used with type "html".

[options.stringList]

String

A JSON array which will serve as dataProvider for select, options, and radio. This array should contain objects with the properties value and label.

[options.prompt]

String

Adds an extra options to the select usually use to request a value selection.

[options.promptValue]

String

The value return by the select "prompt" if the user selects it.

[options.filePreview]

String

false

If the component will show a button to preview an uploaded file. To use with type file.

[options.fileDownload]

String

false

If the component will show a button to download an uploaded file. To use with type file.

[options.filePreviewLabel]

String

Preview

The label of the preview button. To use with type file.

[options.fileDownloadLabel]

String

Download

The label of the download button. To use with type file.

[options.fileUploadLabel]

String

Drag and drop file here, or click to select file.

The label of the upload button. To use with type file.

[options.filePreviewClass]

String

btn-primary

The preview button Bootstrap class. To use with type file.

[options.fileDownloadClass]

String

btn-primary

The download button Bootstrap class. To use with type file.

[options.filePreviewIcon]

String

fas fa-file

The preview button Font Awesome icon class. To use with type file.

[options.fileDownloadIcon]

String

fas fa-file-download

The download button Font Awesome icon class. To use with type file.

[options.uploadURL]

String

The URL of the service uploading the file. To use with type file.

[options.fileTypeList]

String

String containing the comma separated list of accepted file extension. To use with type file.

[options.fileSizeLimit]

Integer

The number of MB allowed to upload. To use with type file.

[options.timer]

Integer

0

The number of milliseconds before trigerint the "timer" even when entering data.

[option.toggleList]

String

The list of comma separated elements which will be toggle together with the component.

cleanClasses()

Cleans the Input from markers like required, missing, and error.

Kind: instance method of Input

focus()

The method to focused the input when in editable mode.

Kind: instance method of Input

getEditable() ⇒ Boolean

Returns if the Input is editable.

Kind: instance method of Input

getInputID() ⇒ String

Returns the input element's ID.

Kind: instance method of Input

getItem() ⇒ Object

Returns the selected data dataProvider's item, or the value if the column is provided.

Kind: instance method of Input

getLabel() ⇒ String

Returns the Input's displayed label.

Kind: instance method of Input

getLinkedColumns() ⇒ String

Return the linked columns. These are the columns which will be updated into the Form's target dataSource.

Kind: instance method of Input

getMode() ⇒ Boolean

Returns the Input's mode.

Kind: instance method of Input

getPreviousValue() ⇒ String

Method to return the original Input value before editing started.

Kind: instance method of Input

getRequired() ⇒ Boolean

Returns if the Input is required.

Kind: instance method of Input

getScope() ⇒ String

Returns the Input's operational scope.

Kind: instance method of Input

getText() ⇒ String

Returns the Input's displayed read-only text.

Kind: instance method of Input

getType() ⇒ String

Returns the input's type.

Kind: instance method of Input

getValue() ⇒ String

Returns the Input's stored value.

Kind: instance method of Input

getVisible() ⇒ Boolean

Returns if the input is visible.

Kind: instance method of Input

hasChanged() ⇒ Boolean

Returns if the Input value has changed.

Kind: instance method of Input

hide()

Hides the

Kind: instance method of Input

load()

Executes loding of data from the dataSource into the Input.

Kind: instance method of Input

markMissing()

Marks the Input as data missing.

Kind: instance method of Input

markRequired()

Marks the Input as required

Kind: instance method of Input

markValidationError()

Marks the Input as entry error.

Kind: instance method of Input

on

Extends the "on" method from the eventManager Class.

Kind: instance property of Input

Param
Type
Description

eventName

String

The event's name.

eventFunction

function

The function to be triggered.

openSelect()

Method to programatically open a HTML Select input element

Kind: instance method of Input

setLabel(label)

Sets the Input's label.

Kind: instance method of Input

Param
Type
Description

label

String

The new label.

setMask()

Sets Input's mask method following http://igorescobar.github.io/jQuery-Mask-Plugin/docs.html

Kind: instance method of Input

setMode(viewMode, setPreviusValue)

Sets the Input's interaction mode.

Kind: instance method of Input

Param
Type
Description

viewMode

Boolean

True sets the input to editing, false sets the input tas read only.

setPreviusValue

Boolean

If true (default) will set the previous value.

setPreviousValue(value)

Method to set the Input's value before editing.

Kind: instance method of Input

Param
Type
Description

value

String

The value to apply.

setScope()

Sets the Input's operational scope. The values are: 0 : Force send 1 : if changed go to DB (default) 2 : if changed go to DataProvider only 3 : Stay in form

Kind: instance method of Input

setStringList(newList)

sets the Input's dataSource using a JSON structure.The JSON's items shoudl have the value and label properties.

Kind: instance method of Input

Param
Type
Description

newList

String

JSON array.

setValue(value)

Changes the Input's stored value.

Kind: instance method of Input

Param
Type
Description

value

String

The new value.

setVisible(mode)

Sets the Input's visible status.

Kind: instance method of Input

Param
Type
Description

mode

Boolean

The visible status.

show()

Shows the

Kind: instance method of Input

toggle(status)

Hides or shows the input based on the provided parameter.

Kind: instance method of Input

Param
Type
Description

status

boolean

True shows and false hides.

validate() ⇒ Integer

Executes a validation process. Returns 0 if no errors and 1 if found errors.

Kind: instance method of Input

on:afterInit (Input)

Event triggered after the Input element has been initialized. Created with the Input.on("afterInit", function(Input){}) method.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

on:afterLoad ($value)

Event triggered when the Input's value has been loaded from the dataSource. Created with the Input.on("afterLoad", function($value){}) method.

Kind: event emitted by Input

Param
Type
Description

$value

Object

The JQuery instance to the input HTML element.

on:afterUpload (Input, status, response)

Event triggered after a file is uploaded. Created with the Input.on("afterUpload", function(Input, status, response){}) method. Returnning false will cancel the update process.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

status

Boolean

The upload process status: true is success and fasle is failure.

response

Object

If the operation was a success it coudl return the reponse text or an object if the reponse is a JSON structure. If the operation returns an error then this will contain the operation javascript object.

on:beforeUpload (Input, formData, fileName, fileSize)

Event triggered before a file is uploaded. Created with the Input.on("beforeUpload", function(Input, formData, fileName, fileSize){}) method. Returnning false will cancel the update process.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

formData

Object

The form used to upload the file.

fileName

String

The name of the file to be uploaded.

fileSize

Integer

The file's size.

on:change (Input)

Event triggered when the Input's value has changed. Created with the Input.on("change", function(Input){}) method.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

on:click (Input)

Event triggered when a Button Input is clicked in data entry mode. Created with the Input.on("click", function(Input){}) method.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

on:clickDownload

Event triggered when input's download button is clicked. Created with the Input.on("clickDownload", function(){}) method.

Kind: event emitted by Input

on:clickPreview

Event triggered when input's preview button is clicked. Created with the Input.on("clickPreview", function(){}) method.

Kind: event emitted by Input

on:fileValidate (Input, typeError, sizeError)

Event triggered after the file extension and size has been validated. Created with the Input.on("fileValidate", function(Input, typeError, sizeError){}) method.

Kind: event emitted by Input

Param
Type
Description

Input

Object

Reference to the Input.

typeError

Boolean

True if the file extension type is not a match.

sizeError

Boolean

True if the size is beyond set bounderies.

on:getValue ($value)

Event triggered when the Input's value is requested. Created with the Input.on("getValue", function($value){}) method.

Kind: event emitted by Input

Param
Type
Description

$value

Object

The JQuery instance to the input HTML element.

on:keyup (event, Input)

Event triggered at input's keyboard keyup event. Created with the Input.on("click", function(even,Input){}) method.

Kind: event emitted by Input

Param
Type
Description

event

Object

The Keyboard event.

Input

Object

Reference to the Input.

on:modeChange (mode, $text, $value)

Event triggered when the Input's mode changes. Created with the Input.on("onChange", function(mode,$text,$vale){}) method.

Kind: event emitted by Input

Param
Type
Description

mode

Boolean

The set mode,

$text

Object

JQuery reference to the input displayed text.

$value

Object

JQuery reference to the inputs input HTML element.

on:setValue (value, $value)

Event triggered when the Input's value is set. Created with the Input.on("setValue", function(value, $value){}) method.

Kind: event emitted by Input

Param
Type
Description

value

String

The value entered.

$value

Object

The JQuery instance to the input HTML element.

on:timer (value, Input)

Event triggered when the Input's data entry timer concludes. Created with the Input.on("timer", function(value, Input){}) method.

Kind: event emitted by Input

Param
Type
Description

value

String

The input stored value.

Input

Object

Reference to the Input.

on:validation (type, value)

Event triggered when a Inputs is validated. Created with the Input.on("validation", function(type,value){}) method.

Kind: event emitted by Input

Param
Type
Description

type

String

The Input's type.

value

String

The input's entered value.