Usable Range
CMS
Example
//可以在脚本中获取表单
//方法1:
var form = this.form.getApp().appForm; //获取表单
//方法2
var form = this.target; //在表单本身的事件脚本中获取
Source
Members
containerElement
表单容器
Type
-
Element
Example
//可以在脚本中获取表单容器
var formContainer = this.form.getApp().appForm.container;
Source
jsonObject
表单的配置信息,比如表单名称等等.
Type
-
Object
Example
//可以在脚本中获取表单配置信息
var json = this.form.getApp().appForm.json; //表单配置信息
var name = json.name; //表单名称
Source
modulesArray
表单中的所有组件数组.
Type
-
Array
Example
//下面的样例对表单组件进行循环,并且判断是输入类型的组件
var modules = this.form.getApp().appForm.modules; //获取所有表单组件
for( var i=0; i<modules.length; i++ ){ //循环处理组件
//获取组件的类型
var moduleName = module.json.moduleName;
if( !moduleName ){
moduleName = typeOf(module.json.type) === "string" ? module.json.type.toLowerCase() : "";
}
if( ["calendar","combox","number","textfield"].contains( moduleName )){ //输入类型框
//do something
}
}
Source
allObject
表单中的所有组件对象.
该对象的key是组件标识,value是组件对象,可以使用该对象根据组件标识获取组件。
需要注意的是,在子表单中嵌入不绑定数据的组件(比如div,common,button等等),系统允许重名。
在打开表单的时候,系统会根据重名情况,自动在组件的标识后跟上 "_1", "_2"。
Type
-
Object
Example
var moduleAll = this.form.getApp().appForm.all; //获取组件对象
var subjectField = moduleAll["subject"] //获取名称为subject的组件
Source
Methods
static
getData() → {Object}
Summary
获取表单的所有数据.
Returns
-
Object
Example
var data = this.form.getApp().appForm.getData();
Source
static
deleteDocument()
Summary
弹出删除文档确认框.
Example
this.form.getApp().appForm.deleteDocument();
Source
static
editDocument()
Summary
编辑文档.
Example
this.form.getApp().appForm.editDocument();
Source
static
editDocumentForMobile()
Summary
移动端开启编辑模式.
Example
this.form.getApp().appForm.editDocumentForMobile();
Source
static
setPopularDocument()
Summary
弹出设置热点的界面.
Example
this.form.getApp().appForm.setPopularDocument();
Source
static
uploadedAttachment(site, id)
Summary
将新上传的附件在指定的附件组件中展现.
Parameters
-
site
String
附件组件的标识
-
id
String
新上传的附件id
Example
this.form.getApp().appForm.uploadedAttachment(site, id);
Source
static
setTop()
Summary
弹出文档置顶对话框,操作后使当前文档在列式服务中排在前面.
Example
this.form.getApp().appForm.setTop();
Source
static
cancelTop()
Summary
弹出文档取消置顶对话框.
Example
this.form.getApp().appForm.cancelTop();
Source
static
downloadAll()
Summary
一键下载表单和附件.
Example
this.form.getApp().appForm.downloadAll();
Source
closeWindowOnMobile()
移动端处理关闭
Source
Events
queryLoad
表单加载前触发。表单html已经就位。
See
beforeLoad
表单加载前触发。数据(businessData)已经就绪。
See
beforeModulesLoad
表单的所有组件加载前触发,此时表单的样式和js head已经加载。
See
postLoad
表单加载后触发。
See
afterModulesLoad
表单的所有组件加载后触发。
See
afterLoad
表单加载后触发。
See
beforeSave
保存前触发。
See
postSave
数据已经整理完成,但还未保存到后台时触发。this.event指向整理完成的数据
See
afterSave
数据保存到后台后触发。
See
beforeClose
关闭前触发。
See
beforePublish
发布前触发。
See
postPublish
数据已经整理完成,但还未调用服务发布触发。this.event指向整理完成的数据
See
afterPublish
执行后台服务发布后触发。
See
beforeWaitPublish
定时发布前触发。
See
postWaitPublish
数据已经整理完成,但还未调用定时发布服务前触发。this.event指向整理完成的数据
See
afterPublish
执行后台定时发布服务后触发。
See
beforeDelete
删除前触发。
See
afterDelete
删除后触发。