botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Question] Cannot choose"C+E Security IS" in a button in FormFlow?

Open radennis opened this issue 9 years ago • 17 comments

System Information

  • SDK Language: .Net
  • SDK Version: 3.8.1.0
  • Development Environment: webchat

Bot Info

  • Bot name: Gaia
  • Bot handle: kustobot
  • App ID:
  • Connected channels:

Issue Description

We compose buttons out of text in our but, in FormFlow. When the button contains "C+E Security IS" it's impossible to click it. We get "“C+E Security IS” is not an existing account name option." Then we specify "2" as the button it the first one, and it chooses a different button. Then we go back and specify 1 and it finally works. But we cannot click the "C+E Security IS".

Can you please fix?

image image

radennis avatar Aug 13 '17 15:08 radennis

Using quotes also doesn't work image

radennis avatar Aug 13 '17 16:08 radennis

This is not a question, it's an issue. Also any update on this?

radennis avatar Aug 15 '17 09:08 radennis

Can you please share your code, we do not have enough info to help you without it.

JasonSowers avatar Aug 15 '17 16:08 JasonSowers

@radennis Please upgrade your bot to v 3.9 and let us know if your issue is resolved. There was a problem with FormFlow fields defined with a Describe attribute, but no Terms: fixed by this PR https://github.com/Microsoft/BotBuilder/pull/2990 (and a few subsequent PRs)

Also, please show how you are defining this form in code, so we are able to reproduce the problem.

Thank you.

EricDahlvang avatar Aug 15 '17 22:08 EricDahlvang

Thanks, I'll upgrade my bot and see if it helps.

Here's a code snippet of how I'm doing it:

        private static Task<bool> DefineExistingPcCode(OnBoardForm state, Field<OnBoardForm> field)
        {
            foreach (var account in GetExistingPcCodes(state))
            {
                field
                    .AddDescription(account, account)
                    .AddTerms(account, account);
            }

            var newAccountChoice = "I have a different Pc Code";
            field
                .AddDescription(c_newPcCodeRequest, newAccountChoice)
                .AddTerms(c_newPcCodeRequest, newAccountChoice);

            field.SetType(null);
            field.SetActive(IsExistingAccountChosen);
            return Task.FromResult(true);
        }

The issue seems to happen when the accout name starts with "C+.."

radennis avatar Aug 16 '17 18:08 radennis

Hi, just wanted to update back that I tried upgrading to 3.9.0.0 and still get the same error. image

Please let us know what can be done.

radennis avatar Aug 17 '17 20:08 radennis

Thanks for the update, we are actively looking into this.

JasonSowers avatar Aug 17 '17 21:08 JasonSowers

@radennis we are unable to repro the same behavior with the code given. Are you able to share your whole project? If not can you at least share the code for your form and what is the IsExistingAccountChosen code?

JasonSowers avatar Aug 17 '17 21:08 JasonSowers

I've sent you the project code separately as we rather not publish it on the web. Here's the snippet you asked for:

        public string GetAccountName()
        {
            return IsExistingAccountChosen(this)
                ? ExistingAccountName
                : NewAccountName;
        }
        public static bool IsExistingAccountChosen(KustoOnBoardForm state)
        {
            var newAccountCondition = string.IsNullOrEmpty(state.ExistingAccountName) ||
                state.ExistingAccountName.Equals(c_newAccountRequest, StringComparison.InvariantCulture);
            return !newAccountCondition;
        }

radennis avatar Aug 20 '17 07:08 radennis

Thank you, I am waiting on approval to view the source.

JasonSowers avatar Aug 21 '17 21:08 JasonSowers

Hi any update on this?

radennis avatar Aug 22 '17 14:08 radennis

We were still not able to reproduce, I am awaiting approval in RAM to view the source to try to repro.

JasonSowers avatar Aug 22 '17 14:08 JasonSowers

@radennis I was able to reproduce, It seems the '+' char in combination with spaces is the issue here. I'm still trying to pin down the exact cause, but if as a workaround, for now, can you try using the work "and" rather than '+' and see if that fixes the problem for you? another option is to use "C+E" rather than "C + E"

JasonSowers avatar Aug 25 '17 21:08 JasonSowers

Thanks @JasonSowers for looking into this. Unfortunatelly I cannot change the content of the button since it is generated by getting the account name. Therefore when the account name if "C + E" I need to show the exact same string to the user...

radennis avatar Aug 27 '17 07:08 radennis

I am still looking into this as a bug, I will update you when I know more.

JasonSowers avatar Aug 28 '17 17:08 JasonSowers

Thanks for the update

radennis avatar Aug 29 '17 08:08 radennis

You need to regex escape your string. The terms we match on our regex and the + is interpreted as a regex.

chrimc62 avatar Sep 07 '17 20:09 chrimc62