Skip to content

Commit c8aa4e9

Browse files
docs(combobox): clarifications on item selection and custom values
1 parent 5067796 commit c8aa4e9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

components/combobox/custom-value.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To enable custom user input set the `AllowCustom` parameter to `true`.
2020
2121
When custom input is allowed, the [ValueChanged event]({%slug components/combobox/events%}) fires on every keystroke, and not when an item is selected, because the ComboBox component acts as a text input.
2222

23-
When custom values are typed in, there will be no selected item in the ComboBox.
23+
When custom values are typed in, there may be no selected item in the ComboBox. See the [ComboBox Overview - Selected Item]({%slug components/combobox/overview%}#selected-item) article for details on when how item selection and `Value` work together.
2424

2525
>caption Allow custom user input in the combo box
2626

components/combobox/events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ The `OnChange` event is suitable for handling custom values the user can enter a
102102
* `OnChange` does not prevent two-way binding (the `@bind-Value` syntax)
103103
* `OnChange` fires only when the user presses `Enter`, or blurs the input (for example, clicks outside of the combo box). It does not fire on every keystroke, even when `AllowCustom="true"`, and it does not fire when an item is selected from the dropdown.
104104

105-
See the [ComboBox Overview - Selected Item]({%slug components/combobox/overview%}#selected-item) article for details on when the event fires and how item selection works.
105+
See the [ComboBox Overview - Selected Item]({%slug components/combobox/overview%}#selected-item) article for details on when the event fires and how item selection and `Value` work.
106106

107-
>caption Handle OnChange without custom values - you must write text that will match an item.
107+
>caption Handle OnChange without custom values - to get a value from the list, you must write text that will match the text of an item (e.g, "item 5").
108108
109109
````CSHTML
110110
@result

components/combobox/overview.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ The ComboBox will not always have a selected item, however, because it can act a
9494

9595
Missing selection is most common when the initial value is `null` as data sources rarely have items with a `null` value, and/or when you want to let your users type in values that are not in your predefined set of options.
9696

97-
If the user types text in the input, selection behaves according to the following table:
97+
>caption If the user types text in the input, selection behaves according to the following table:
9898
9999

100-
| User input matches the value of an item | AllowCustom=`true` | AllowCustom=`false` |
100+
| User input matches | AllowCustom=`true` | AllowCustom=`false` |
101101
|----------------------------|----------------------|------------------------------------------|
102-
| Yes | Matched item is selected. | Matching item is selected. |
103-
| No | No item is selected. `Value` is updated to the custom one. | No item is selected. `Value` is updated to `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
102+
| The `TextField` of an item | Matched item is selected. The `Value` is taken from the item. | Matched item is selected. The `Value` is taken from the item. |
103+
| The `ValueField` of an item | No item is selected. `Value` is updated to the custom one. | No item is selected. `Value` is updated to `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
104+
| No match | No item is selected. `Value` is updated to the custom one. | No item is selected. `Value` is updated to `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
105+
104106

105107

106108

0 commit comments

Comments
 (0)