Help #23330
Replies: 2 comments 1 reply
-
|
Hi @jurentiancheng! I'm Dosu and I’m helping the dify team. Dify's user input forms support dropdowns with static options, but do not natively support cascading (linked) dropdowns where the options of one depend on another. However, Dify recently introduced a To implement cascading province-city-region dropdowns, you would:
Here’s a conceptual YAML snippet: user_input_form:
- select:
label: 出生省份
variable: birth_province
options: [ ...省份列表... ]
required: true
- dynamic-select:
label: 出生城市
variable: birth_city
options: [] # Will be filled dynamically based on province
required: true
- dynamic-select:
label: 出生区县
variable: birth_district
options: [] # Will be filled dynamically based on city
required: trueYou must implement the backend logic (or workflow node) that listens for changes in If you need a workaround and cannot use dynamic-select, some users simulate this by rendering custom HTML in the output node, but this is not a native solution. Let me know if you need more technical details or a sample backend implementation! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much for your help, I'll try it right away.
dosubot[bot] ***@***.***> 于2025年8月3日周日 21:41写道:
… Hi @jurentiancheng <https://github.com/jurentiancheng>! I'm Dosu
<https://go.dosu.dev/dosubot> and I’m helping the dify team.
Dify's user input forms support dropdowns with static options, but do not
natively support cascading (linked) dropdowns where the options of one
depend on another. However, Dify recently introduced a dynamic-select
form type, which allows dropdown options to be dynamically updated based on
backend logic or workflow state. This can be used to implement cascading
dropdowns, but it requires you to set up backend endpoints or workflow
nodes that provide the correct options based on previous selections. The
frontend will render the updated options when the backend supplies them.
To implement cascading province-city-region dropdowns, you would:
1. Use the dynamic-select type for your city and region fields.
2. When a user selects a province, your backend or workflow should
update the available city options and return them to the frontend.
3. When a user selects a city, your backend or workflow should update
the available region options accordingly.
Here’s a conceptual YAML snippet:
user_input_form:
- select:
label: 出生省份
variable: birth_province
options: [ ...省份列表... ]
required: true
- dynamic-select:
label: 出生城市
variable: birth_city
options: [] # Will be filled dynamically based on province
required: true
- dynamic-select:
label: 出生区县
variable: birth_district
options: [] # Will be filled dynamically based on city
required: true
You must implement the backend logic (or workflow node) that listens for
changes in birth_province and birth_city and returns the appropriate
options for the next dropdown. This is not handled automatically by Dify’s
frontend; it relies on your backend to supply the correct dynamic options
at each step. There are no official documentation examples for this yet,
but the feature is supported in the codebase and can be leveraged for your
use case reference <#23323>.
If you need a workaround and cannot use dynamic-select, some users
simulate this by rendering custom HTML in the output node, but this is not
a native solution.
Let me know if you need more technical details or a sample backend
implementation!
*To reply, just mention @dosu <https://go.dosu.dev/dosubot>.*
------------------------------
How did I do? Good
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=great_response>
| Irrelevant
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=irrelevant_answer>
| Incorrect
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=incorrect_sources>
| Verbose
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=too_verbose>
| Hallucination
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=hallucination>
| Report 🐛
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=bug_report>
| Other
<https://app.dosu.dev/response-feedback/2b97a3c4-ccc6-40a8-8b8e-351a9594a2bb?feedback_type=other>
[image: Chat with Dosu]
<https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github>
[image: Join Discord] <https://go.dosu.dev/discord-bot> [image: Share on
X]
<https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/discussions/23330>
—
Reply to this email directly, view it on GitHub
<#23330 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABB54MVD6NYM74BUSGDUO3T3LYGR3AVCNFSM6AAAAACC77Z4YOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGOJXGY3TMMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
I want to create an agent application that requires users to enter multiple conditions, three of which are drop-down boxes requiring users to select their province, city, and region, and these three conditions need to have a linked effect. How can I implement this in dify? Please provide me with a reference example. Thank you very much!
2. Additional context or comments
My process DSL content is as follows:
app:
description: 专业的个人星盘分析工具,提供详细的星座解读和运势分析。根据用户提供的出生信息,计算个人星盘并提供专业解读。
icon: 🌟
icon_background: '#6366f1'
mode: agent-chat
name: 专业星盘解读助手
use_icon_as_answer_icon: true
kind: app
model_config:
agent_mode:
enabled: true
max_iteration: 5
prompt: null
strategy: react
tools:
- enabled: true
isDeleted: false
notAuthor: false
provider_id: webscraper
provider_name: webscraper
provider_type: builtin
tool_label: 网页爬虫
tool_name: webscraper
tool_parameters:
generate_summary: ''
url: ''
user_agent: ''
- enabled: true
isDeleted: false
notAuthor: false
provider_id: wikipedia
provider_name: wikipedia
provider_type: builtin
tool_label: 维基百科搜索
tool_name: wikipedia_search
tool_parameters:
language: ''
query: ''
annotation_reply:
enabled: false
chat_prompt_config: {}
completion_prompt_config: {}
dataset_configs:
datasets:
datasets: []
reranking_enable: false
retrieval_model: multiple
top_k: 4
dataset_query_variable: ''
external_data_tools: []
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
- .MP4
- .MOV
- .MPEG
- .MPGA
allowed_file_types: []
allowed_file_upload_methods:
- remote_url
- local_file
enabled: false
image:
detail: high
enabled: false
number_limits: 3
transfer_methods:
- remote_url
- local_file
number_limits: 3
model:
completion_params:
stop: []
mode: chat
name: qwen-vl-max
provider: tongyi
more_like_this:
enabled: false
opening_statement: '🌟 欢迎使用专业星盘解读助手!
请填写您的出生信息,我将为您提供详细的星盘分析和个性化解读。
💡 提示:请确保出生时间和地点的准确性,这将影响星盘计算的精确度。'
pre_prompt: '你是一位经验丰富的专业占星师,拥有深厚的占星学知识和丰富的解读经验。
prompt_type: simple
retriever_resource:
enabled: true
sensitive_word_avoidance:
configs: []
enabled: false
type: ''
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
user_input_form:
default: ''
label: 您的姓名(可选)
max_length: 50
required: false
variable: user_name
default: ''
label: 出生省份
options:
required: true
variable: birth_province
default: ''
label: 出生城市
options: []
required: true
variable: birth_city
default: ''
label: 出生区县
options: []
required: true
variable: birth_district
default: ''
label: 出生日期(格式:YYYY-MM-DD)
max_length: 20
required: true
variable: birth_date
default: ''
label: 出生时间(格式:HH:MM,24小时制)
max_length: 10
required: true
variable: birth_time
default: ''
label: 性别(可选)
max_length: 10
required: false
variable: gender
version: 0.1.7
Beta Was this translation helpful? Give feedback.
All reactions