Skip to main content
  1. Work Notes/
  2. Common Snippets/

Field Linkage: Write Select Display Text to a Text Field

·124 words·1 min
Ecology Common Snippets Code Snippets Field Linkage
Author
molefool
Table of Contents

The same requirement can be implemented in two ways: SQL in field linkage, or JavaScript in a code block.

Option 1: Field-Linkage SQL
#

SELECT selectname
FROM workflow_selectitem
WHERE fieldid = '字段id'
  AND selectvalue = 选项值;

Replace 字段id with the select field ID and 选项值 with the current select option value. When the field linkage runs, the returned selectname is the display text to write into the target text field.

Option 2: Code-Block JavaScript
#

WfForm.bindFieldChangeEvent("field44206", function(obj,id,value){ // 下拉框值改变时触发动作
    var ccqy = WfForm.getSelectShowName("field44206"); // 获取下拉框显示值
    WfForm.changeFieldValue("field68449", {value:ccqy}); // 赋值下拉框选项值给给文本字段
});
  • field44206 is the source select field.
  • field68449 is the target text field.
  • getSelectShowName reads the current display text of the select field.
  • changeFieldValue writes the display text into the target text field.

Related