-
Notifications
You must be signed in to change notification settings - Fork 300
Expand file tree
/
Copy pathcountry-state.yml
More file actions
45 lines (44 loc) · 1016 Bytes
/
country-state.yml
File metadata and controls
45 lines (44 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
metadata:
title: Update dropdown
short title: Dropdown
documentation: "https://docassemble.org/docs/background.html#background_response"
example start: 1
example end: 2
---
question: |
Where do you live?
fields:
- Country: country
code: countries_list()
- State: state
code: |
states_list(country_code=showifdef('country', 'US', prior=True)) \
or \
['N/A']
js enable if: val('country')
check in: update_states_list
---
event: update_states_list
code: |
if action_argument('_changed') == 'country':
background_response(
{
'state':
{
'choices': \
states_list(country_code=action_argument('country')) \
or \
['N/A']
}
}, 'fields')
background_response()
---
mandatory: True
question: |
You live in
${ state_name(state, country_code=country) }
in
${ country_name(country) }.
subquestion: |
Your country code is `${ country }`.
Your state code is `${ state }`.