File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
source/nodejs/adaptivecards/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3373,8 +3373,9 @@ export class ChoiceSetInput extends Input {
33733373
33743374 for ( let choice of this . choices ) {
33753375 let option = document . createElement ( "option" ) ;
3376- option . value = < string > choice . value ;
3377- option . text = < string > choice . title ;
3376+ // To fix https://stackoverflow.com/questions/29882361/show-datalist-labels-but-submit-the-actual-value
3377+ // value is mapped to choice.title other than choice.value
3378+ option . value = < string > choice . title ;
33783379 option . setAttribute ( "aria-label" , < string > choice . title ) ;
33793380
33803381 dataList . appendChild ( option ) ;
@@ -3491,6 +3492,13 @@ export class ChoiceSetInput extends Input {
34913492 return this . _selectElement . selectedIndex > 0 ? this . _selectElement . value : undefined ;
34923493 }
34933494 else if ( this . _textInput ) {
3495+ for ( let choice of this . choices )
3496+ {
3497+ if ( choice . title && this . _textInput . value === choice . title )
3498+ {
3499+ return choice . value ;
3500+ }
3501+ }
34943502 return this . _textInput . value ;
34953503 }
34963504 else if ( this . _toggleInputs && this . _toggleInputs . length > 0 ) {
You can’t perform that action at this time.
0 commit comments