Constructors
The ScriptFieldModel represents a script field in a script parameter form and provides various methods to inspect and manipulate the field model data.
Every ScriptFieldModel is a Backbone.Model.
- Since:
- 5.0d
- See:
Extends
Members
-
TypesString
-
enumeration of different field types.
Properties:
Name Type Default Description CHECKBOXString CHECKBOX CUSTOMString CUSTOM DATEString DATE DOUBLE_LISTString DOUBLE_LIST EMAILString EMAIL ENUMString ENUM FILING_PLANString FILING_PLAN GADGETString GADGET HISTORYString HISTORY HTMLString HTML NUMBERString NUMBER PASSWORDString PASSWORD RADIOString RADIO REFERENCEString REFERENCE SEPARATORString SEPARATOR STRINGString STRING TEXTString TEXT TEXT_FIXEDString TEXT_FIXED TIMESTAMPString TIMESTAMP URLString URL
Methods
-
inherited getBgColor(){String}
-
Returns the background color of the field.
Returns:
Type Description String the field background color -
inherited getBorderColor(){String}
-
Returns the border color of the field.
Returns:
Type Description String the field border color -
inherited getColor(){String}
-
Returns the font color of the field.
Returns:
Type Description String the field font color -
inherited getEnumValues(){Array.<Object>}
-
Returns the optional enum values of the field.
Returns:
Type Description Array.<Object> the field enum values Example
Return format: [{"label" : "label1", "selected": false, "value": "value1"}, {"label" : "label2", "selected": true, "value": "value2"}, ...] -
inherited getId(){String}
-
Returns the id of the field.
Returns:
Type Description String the field id -
inherited getLabel(){String}
-
Returns the label of the field.
Returns:
Type Description String the field label -
inherited getLabelColor(){String}
-
Returns the font color of the fields label.
Returns:
Type Description String the font color of the fields label -
inherited getName(){String}
-
Returns the technical name of the field.
Returns:
Type Description String the technical field name -
inherited getTooltip(){String}
-
Returns the tooltip of the field.
Returns:
Type Description String the field tooltip -
inherited getType(){String}
-
Returns the type of the field.
- See:
Returns:
Type Description String the field type -
inherited getValue(){String|Array.<String>|Boolean}
-
Returns the value(s) of the field.
- See:
Returns:
Type Description String | Array.<String> | Boolean the field value -
inherited isGuiReadonly(){Boolean}
-
Returns if the field is gui readonly or not.
- See:
Returns:
Type Description Boolean trueif the field is gui readonly,falseotherwise -
inherited isMandatory(){Boolean}
-
Returns if the field is mandatory or not.
Returns:
Type Description Boolean trueif the field is mandatory,falseotherwise -
inherited isReadonly(){Boolean}
-
Returns if the field is readonly or not.
- See:
Returns:
Type Description Boolean trueif the field is readonly,falseotherwise -
inherited isSameLine(){Boolean}
-
Returns if the field is in the same line as the preceding field or not.
Returns:
Type Description Boolean trueif the field is in the same line as the preceding field,falseotherwise -
inherited setAutoComplete(options)
-
Adds autocomplete to a field. Only works for STRING fields.
Name Type Description optionsObject the autocomplete config
Name Type Description scriptNameString the name of the script
minQueryCharsNumber optional amount of letters after which autocomplete starts
queryDelayNumber optional time interval, after which autocomplete starts
maxResultsNumber optional max amount of autocomplete entries
autoFocusResultBoolean optional focus on the first autocomplete entry
Example
documents.sdk.exitRegistry.registerSearchExitCallback("ExtendedSearch.afterSetModelData", function(documentsContext, options) { var fields = options.searchForm.getSearchFields(); var field = fields.get("crmName"); field.setAutoComplete({ scriptName: "auto", minQueryChars: 2, queryDelay: 0.5, maxResults: 25, autoFocusResult: false }) }); -
inherited setBgColor(color)
-
Sets the background color of the field.
Name Type Description colorString the field background color. All color definitions available in CSS3 are supported as parameters.
Example
//the following method calls are showing different ways to change the background color to red: field.setBgColor("red"); field.setBgColor('#FF0000'); field.setBgColor('rgb(255,0,0)'); field.setBgColor('hsl(0, 100%, 50%)'); field.setBgColor('cmyk(0%, 100%, 100%, 0%)'); -
inherited setBorderColor(color)
-
Sets the border color of the field.
Name Type Description colorString the field border color. All color definitions available in CSS3 are supported as parameters.
Example
//the following method calls are showing different ways to change the border color to red: field.setBorderColor("red"); field.setBorderColor('#FF0000'); field.setBorderColor('rgb(255,0,0)'); field.setBorderColor('hsl(0, 100%, 50%)'); field.setBorderColor('cmyk(0%, 100%, 100%, 0%)'); -
inherited setColor(color)
-
Sets the font color of the field.
Name Type Description colorString the field font color. All color definitions available in CSS3 are supported as parameters.
Example
//the following method calls are showing different ways to change the font color to red: field.setColor("red"); field.setColor('#FF0000'); field.setColor('rgb(255,0,0)'); field.setColor('hsl(0, 100%, 50%)'); field.setColor('cmyk(0%, 100%, 100%, 0%)'); -
inherited setEnumValues(enumValues, options)
-
Sets the optional enum values of the field. Supported input-formats can be viewed in the examples.
Name Type Description enumValuesObject | Array.<Object> | String | Array.<String> the field enum values
optionsObject the options passed
Name Type Description keepSelectedBoolean optional trueif the current selected entry should be set as the next selected entry. If it is not included within the enumValues it will be added. Default isfalse.addEmptyEntryBoolean optional trueif an empty entry should be added to the enumValues. Default isfalseExamples
// 1. default enum value format [{"label" : "label1", "selected" : false, "value" : "value1"}, {"label" : "label2", "selected" : true, "value" : "value2"}, ...]// 2. value-only enum value formats // a. String "value1,value2,..." // b. String[] ["value1", "value2", ...]// 3. key-value enum value formats // a. String "value1:label1,value2:label2,..." // b. Object {"value1" : "label1", "value2" : "label2", ...}// 4. localized enum value formats // a. String "value1;locale1:label1;locale2:label2,value2;locale1:label1;locale2:label2,..." // b. String[] ["value1;locale1:label1;locale2:label2", "value2;locale1:label1;locale2:label2", ...] // c. Object {"value1" : {"locale1" : "label1", "locale2" : "label2"}, "value2" : {"locale1" : "label1", "locale2" : "label2"}, ...} -
inherited setExit(options)
-
Sets an exit configuration of the field.
A trigger type of the exit must always be set. Valid types arefocusin,focusout,changeandbutton.
If an exit configuration is set, a corresponding field exit callback must be registered in the exitRegistry.Name Type Description optionsObject the exit configuration options
Name Type Description typeString the exit trigger type
imageString optional the exit button image, if the
typeequalsbuttontooltipString optional the exit button image tooltip, if the
typeequalsbuttonExamples
field.setExit({ type: "focusout" });field.setExit({ type: "button", tooltip: "search for contact", image: "entypo:flashlight" }); -
inherited setGuiReadonly(guiReadonly)
-
Sets the field to gui readonly.
Name Type Description guiReadonlyBoolean truefor gui readonly,falseotherwise- See:
-
inherited setLabel(label)
-
Sets the label of the field.
Name Type Description labelString the field label
-
inherited setLabelColor(color)
-
Sets the font color of the fields label.
Name Type Description colorString the font color of the fields label. All color definitions available in CSS3 are supported as parameters.
Example
//the following method calls are showing different ways to change the labels font color to red: field.setLabelColor("red"); field.setLabelColor('#FF0000'); field.setLabelColor('rgb(255,0,0)'); field.setLabelColor('hsl(0, 100%, 50%)'); field.setLabelColor('cmyk(0%, 100%, 100%, 0%)'); -
inherited setName(name)
-
Sets the technical name of the field.
Name Type Description nameString the technical field name
-
inherited setReadonly(readonly)
-
Sets the field to readonly.
Name Type Description readonlyBoolean truefor readonly,falseotherwise- See:
-
inherited setSameLine(sameLine)
-
Sets the field to the same line as the preceding field.
Name Type Description sameLineBoolean truefor same line as the preceding field,falseotherwise -
inherited setTooltip(tooltip)
-
Sets the tooltip of the field.
Name Type Description tooltipString the field tooltip
-
inherited setType(type)
-
Sets the type of the field.
In case of changing a field into a checkbox or a radio-group, the displayed options will be set to a default value. If you want to change them, please use the method setEnumValues.Name Type Description typeFieldModel.Types the field type
- See:
Example
// This example changes the field type to date using documents.sdk.FieldModel.Types enum. field.setType(documents.sdk.FieldModel.Types.DATE); //The following code can be used to change the displayed options of radio-groups or checkboxes. field.setType(documents.sdk.FieldModel.Types.RADIO); field.setEnumValues(["1:one","2:two"]); -
inherited setValue(value, options)
-
Sets the value(s) of the field.
Any matching enum values will be updated automatically.Name Type Description valueString | Array.<String> | Boolean the field value
optionsObject optional Name Type Description silentBoolean optional When
truethe silent mode is active, no backbone events will be triggered, if the model changes- See: