Skip to main content

When the value of the form component is empty, the component is hidden.

1. Usage scenarios

When we submit data, if the value of a component that is not required is empty, the component is hidden on the submitted data details page.

2. Video Display

此处为语雀视频卡片,点击链接查看:新-当表单组件值为空时隐藏该组件.mov

3. Code Reference

3.1 create a form

Create a normal form and add a single-line text component

Form editing page

3.2 Open JS panel and add code

JS panel

The code is triggered when the page is loaded (added after didmount).

Refer to the code (just copy it directly and replace the unique identifier):

  let Bvalue = this.$('textField_kq2csyl7').getValue()//获取那个组件的值
if (!this.utils.isSubmissionPage()){//判断是否是提交页
if (Bvalue==""||Bvalue==null){//判断值是否为空
this.$('textField_kq2csyl7').setBehavior("HIDDEN")
}

}

3.3 Final effect

Submit directly without filling in any data;

When you view the details page, the component is hidden.

-------------------- Get the latest information YIDA, welcome to follow US--------------------

This doc is generated using machine translation. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes.
Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4