简体   繁体   中英

How to change user input in FormFlow

I'm using FormFlow in bot framework. What is the best way to store the user's input differently after he answers a question?

For instance, I would like to ask "What is your name" and then store only the first word before the next whitespace.

I found the answer. Validate can be used for that purpose (see this , "Adding Business Logic" section)

Here's an example of how I did it:

.Field(nameof(ClusterName), validate: (state, value) => Task.FromResult(new ValidateResult
                {
                    Value = state.GetFirstName((string)value),
                    IsValid = true
                }))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM