App JScript
App JScript is a fast, small, and feature-rich JavaScript library. It makes things like HTML document coding very simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, App JScript become an important part of the Exceed Notes design.
AppDesign is an object reference App JScript library.
Note:
Click
to the details.
Document
AppDesign.Document includes document attributes.
| Attribute | Return value | Example | Description |
|---|---|---|---|
| status | the state value defined in workflow | AppDesign.Document.status() |
Get the document status |
| pageMode | edit; add; preview | AppDesign.Document.pageMode |
Get the page mode |
| appCode | Current app code | AppDesign.Document.appCode |
Get current app code |
| tenantId | Current tenant id | AppDesign.Document.tenantId |
Get current tenant id |
SetDefaultState
SetDefaultState(stateValue)Set the default state of the document when creating a new document
| Parameter Name | Type | Description |
|---|---|---|
| stateValue | String | The default value |
AppDesign.Document.SetDefaultState("stateValue");
loading
loading()Pop-up layer prompts to loading
AppDesign.Document.loading();
endLoading
endLoading()Close the loading prompts
AppDesign.Document.endLoading();
Section
AppDesign.Section(sourceSectionField) Get the matched section by the included field name
| Parameter Name | Type | Description |
|---|---|---|
| sourceSectionField | String | the included field name |
| return value | Type | introduction |
|---|---|---|
| matched section | Object | The matched elements of section. |
AppDesign.Section("Title")
show
show()Display the matched section.
AppDesign.Section("sourceSectionIncludedFieldName").show
hide
hied() Hide the matched section.
AppDesign.Section("sourceSectionIncludedFieldName").hide();
enabled
enabled() Enabled the matched section
AppDesign.Section("sourceSectionContentFieldName").enabled();
disabled
disabled() Disabled the matched section
AppDesign.Section("sourceSectionContentFieldName").disabled();
Field
AppDesign.Field(sourceField) Get the matched elements of field name
| Parameter Name | Type | Description |
|---|---|---|
| SourceField | String | Field Name |
| return value | Type | introduction |
|---|---|---|
| Source field object | Object | The matched elements of field, Equivalent to $("[name='Title']") |
AppDesign.Field("Title")
setValue
setValue(targetValue) Assign value to field.
| Parameter Name | Type | Description |
|---|---|---|
| targetValue | String | Assign this value to field |
AppDesign.Field("sourceFieldName").setValue("targetValue")
getValue
getValue() Get field value.
| return value | Type | introduction |
|---|---|---|
| The value of field | string | The value of field, Equivalent to $("[name='Title']").val() |
AppDesign.Field("sourceFieldName").getValue()
attribute
attribute(attributeKey,attributeValue) Modify or add field attribute, Equivalent to $("[name='Title']").attr(attributeKey,attributeValue)
| Parameter Name | Type | Description |
|---|---|---|
| attributesKey | String | The key of attribute |
| attributesValue | String | The value of attribute |
AppDesign.Field("sourceFieldName").attribute("attributeKey","attributeValue");
AppDesign.Field("Title").attribute("disabled","disabled");
setValidation
setValidation() This field needs to be input validation when submitting form data.
AppDesign.Field("sourceFieldName").setValidation();
removeValidation
removeValidation() This field does not needs to be input validation when submitting form data.
AppDesign.Field("sourceFieldName").removeValidation();
empty
empty() Clear the selected information for the field.
AppDesign.Field("sourceFieldName").empty();
type
type() Get control type.
| return value | Type | introduction |
|---|---|---|
| Radio | String | Radio control introduction |
| CheckBox | String | CheckBox control introduction |
| TextBox | String | TextBox control introduction |
| TextBox(Hidden) | String | TextBox(Hidden) control introduction |
| People Picker | String | People Picker control introduction |
| TextArea | String | TextArea control introduction |
| Rich Text | String | Rich Text control introduction |
| Select(Multi) | String | Select(Multi) control introduction |
| Select(Single) | String | Select(Single) control introduction |
| Section | String |
AppDesign.Field("sourceFieldName").type();
addClass
addClass(className) Add a css class to the field. Equivalent to $("[name='Title']").addClass(className)
| Parameter Name | Type | Description |
|---|---|---|
| className | String | Css name |
AppDesign.Field("sourceFieldName").addClass("className");
inputRegular
inputRegular(regular) Set regular expression for the field input validation.
| Parameter Name | Type | Description |
|---|---|---|
| regular | String | regular expression |
AppDesign.Field("sourceFieldName").inputRegular("regularText");
invalidMessage
invalidMessage(msg) Set the message to remind the user to input field value correctly.
| Parameter Name | Type | Description |
|---|---|---|
| msg | String | The message of dialog |
AppDesign.Field("sourceFieldName").invalidMessage("invalidMessage");
displayValueInTitle
displayValueInTitle() This field value will display in the title
AppDesign.Field("sourceFieldName").displayValueInTitle();
show
show()Display the matched field., Equivalent to $("[name='Title']").show()
AppDesign.Field("sourceFieldName").show();
hide
hied() Hide the matched field, Equivalent to $("[name='Title']").hide()
AppDesign.Field("sourceFieldName").hide();
changeToShowHide
changeToShowHide(sourceFieldValue, targetField) Set the change event for source field to change the display or hide of target field
| Parameter Name | Type | Description |
|---|---|---|
| sourceFieldValue | Array of String | The values of source field when target field show |
| targetField | Array of String | The field name collection of show or hide item when source field changed |
AppDesign.Field("sourceFieldName").changeToShowHide(
["sourceFieldValue1","sourceFieldValue2"],
["targetField1","targetField2"]
);
enabled
enabled() Enabled the matched elements
AppDesign.Field("sourceFieldName").enabled();
disabled
disabled() Disabled the matched elements
AppDesign.Field("sourceFieldName").disabled();
calendarChange
calendarChange(callBackFunction()) Override the calendar control change function by call back function.
AppDesign.Field("CalendarName").calendarChange(function(){console.log("Calendar have been changed!")});
ActionButton
AppDesign.ActionButton(buttonName) Gets the matched button by button name
| Parameter Name | Type | Description |
|---|---|---|
| buttonName | String | the button name |
| return value | Type | introduction |
|---|---|---|
| matched button | Object | The matched button element. |
AppDesign.ActionButton("Submit")
show
show()Display the matched button.
AppDesign.ActionButton("buttonName").show();
hide
hied() Hide the matched button.
AppDesign.ActionButton("buttonName").hide();
enabled
enabled() Enabled the matched button
AppDesign.ActionButton("buttonName").enabled();
disabled
disabled() Disabled the matched button
AppDesign.ActionButton("buttonName").disabled();
User
AppDesign.User(callBackFunction) Get the current user message
| Parameter Name | Type | Description |
|---|---|---|
| callBackFunction | function | Get the current user information through the callback function |
| return value | Type | introduction |
|---|---|---|
| Roles | String | User roles |
| StaffId | String | Staff Id. |
| StaffName | String | Staff name. |
AppDesign.User(function(user){
console.log(user.Roles) ; console.log(user.StaffId); console.log(user.StaffName);});
Dialog
AppDesign.Dialog() Pop up a message box.
| constant | Type | Description |
|---|---|---|
| AppDesign.Dialog.TYPE_DEFAULT | String | Information |
| AppDesign.Dialog.TYPE_INFO | String | Information |
| AppDesign.Dialog.TYPE_SUCCESS | String | Success |
| AppDesign.Dialog.TYPE_WARNING | String | Warning |
| AppDesign.Dialog.TYPE_DANGER | String | Danger |
alert
alert(title, message, type)Pop up a message box.
AppDesign.Dialog.alert("title","message",AppDesign.Dialog.TYPE_DANGER);
confirm
confirm(title, message, cancelDoFunction, okDoFunction, type) Pop up the message box, and you need to select the next step.
AppDesign.Dialog.confirm
("title","message",
function(){console.log("Yup")},
function(){console.log("Nope")},
AppDesign.Dialog.TYPE_DANGER);