question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request the 'ChoiceInput' form provides an extra field 'choice.description' over 'choice.value'

See original GitHub issue

Is your feature request related to a problem? Please describe.

Sometimes, I want the choice text more descriptive in my ChoiceInput, however, the input value bot collected will also be the descriptive text, it makes me painful when dealing with the choice result in following actions.

image

Describe the solution you’d like

There should have two fields in a choice, one for choice description and will be shown in webchat, another for the real choice value which will be saved to memory as the result. The key names, for example, choice.value and choice.description.

Describe alternatives you’ve considered

I know I can choose ‘index’ as the output format, it’s definitely an alternative solution. Is it possible to give some hints in the editor to let user know the real text value of the choice index?

Additional context My ‘Output Format’ is set to ‘value’.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vishwacsenacommented, Apr 10, 2020

@cwhitten the capability exists in the SDK to express display text (description rendered on screen) .vs. value via cardAction. Here is the example in both C# sample as well as declarative JSON. Can you take a look and let us know if you need anything else to light up the card action experience in composer from a schema definition POV?

var rootDialog = new AdaptiveDialog("root")
{
    Generator = new TemplateEngineLanguageGenerator(),
    Triggers = new List<OnCondition>()
    {
        new OnBeginDialog()
        {
            Actions = new List<Dialog>()
            {
                new ChoiceInput()
                {
                    Property = "user.choice",
                    Prompt = new ActivityTemplate("What do you want?"),
                    Choices = new ChoiceSet(new List<Choice>()
                    {
                        new Choice()
                        {
                            Value = "foo",
                            Action = new CardAction()
                            {
                                Type = "imBack",
                                Title = "Amazing foo",
                                DisplayText = "Amazing foo was clicked",
                                Value = "foo"
                            }
                        },
                        new Choice()
                        {
                            Value = "bar",
                            Action = new CardAction()
                            {
                                Type = "imBack",
                                Title = "Amazing bar",
                                DisplayText = "Amazing bar was clicked",
                                Value = "bar"
                            }
                        }
                    })
                },
                new SendActivity("I have ${user.choice}")
            }
        }
    }
};

And here is the declarative form

{
    "$kind": "Microsoft.AdaptiveDialog",
    "triggers": [
        {
            "$kind": "Microsoft.OnUnknownIntent",
            "actions": [
                {
                    "$kind": "Microsoft.ChoiceInput",
                    "property": "user.choice",
                    "prompt": "Pick one",
                    "choices": [
                        {
                            "value": "foo",
                            "action": {
                                "type": "imBack",
                                // descriptive text
                                "title": "Amazing foo",
                                "value": "foo"
                            }
                        },
                        {
                            "value": "bar",
                            "action": {
                                "type": "imBack",
                                // descriptive text 
                                "title": "Amazing bar",
                                "value": "bar"
                            }
                        }
                    ]
                },
                {
                    "$kind": "Microsoft.SendActivity",
                    "activity":  "I have ${user.choice}"
                }
            ]
        }
    ]
}
0reactions
vishwacsenacommented, Apr 10, 2020

@tomlm one more schema update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request the 'ChoiceInput' form provides an extra field ' ...
There should have two fields in a choice, one for choice description and will be shown in webchat, another for the real choice...
Read more >
Setting Choice Field default value on New Form
Solved: I have a PowerApps form linked to a SharePoint list. The SP list has a choice field (let's call it Status) with...
Read more >
Lookup field - Cognito Forms
The choice description provides extra information about each choice value. It does not display as part of the value, and will not be...
Read more >
ChoiceType Field (select drop-downs, radio buttons & ...
Returns the string "value" for each choice, which must be unique across all choices. This is used in the value attribute in HTML...
Read more >
Choice field
A Choice field allows users to select from predefined options in the form of a dropdown, radio buttons, or checkboxes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found