-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add isRequired to inputs #1978
Comments
Didn't the XAML validation changes to the Text Input controls get pushed back to 19H1? Android by default support field validation, but I can't speak for iOS. Do the FluentWeb/Fabric fields support validation states for HTML renderers? |
We would add validation UI ourselves for platforms that don't have any. |
Author ability to specify "required" text, and it's mandatory so we don't have to localize |
Approved, updated with changes from our proposal review for adding the Note that in the proposal review, we discussed the ability to specify the |
Thanks for the wonderful work team. I understand that asking for a release date is bad, but we're using adaptive cards heavily in one of our bots and input validation is one of the important features we're missing. Do we have any tentative date for the 1.2 release or is any beta url for 1.2 with Input validation that I can test ? |
Thanks @vijaysaimutyala! We still don't have any release date to share, but we've almost implemented all the 1.2 features so we're nearing the end. However, we haven't implemented this feature yet, so there's currently nothing you can try out. But this is a high priority feature (and planned to be part of 1.2), so we'll be working on it soon! By the way, this feature only allows you to mark a field as required. It does NOT provide support for validating a valid email address, phone number, etc... if you need those features, let us know (and those will be addressed in a separate feature). Thanks! |
Glad to know this @andrewleader. Marking the field as required will have most of the job done. But client side verification of inputs like email address or Phone Number like you said would be great. I'll try and come up with what all inputs validations will be useful. Thanks. |
As I implement the feature, I would like to suggest a couple changes to the spec:
|
One more thing:
|
Good points, I agree with renaming to For the built-in default failure message, our concern is that it means we have to provide localized text for the default failure message. Additionally, we believe that in most cases, developers use custom strings anyways (but that's just a guess, we don't have evidence backing it up). Our main concern would be the localized text. For hosts retrieving failed input validations, what would be the purpose of this? What's the use case? I'm sure you have one, but we need to know it before it makes sense to add those APIs :) Agreed about I can start a conversation with the whole team about these points Monday, but some more clarity around why you think we should have the two middle features will help! |
@andrewleader I know about that localization concern given I am part of that collective "we" you reference and helped shape this spec. As I implement it though, I do believe requiring the failure message is overkill. Maybe our default should be to not show an error message if not specified; this eliminates the localization issue. As for the method/event:
|
I suggest we use errorMessage (which is somewhat standard) instead of validationFailedText. That's what I will implement now, and I can always change it if necessary. |
After consideration, we're making the following updates to the spec...
|
@andrewleader Did this make to the 1.2 release. We're able to access the necessity function in the official adaptivecards.io designer and it does not seem to work. Also I could find something here(#3066) |
That issue #3066 is correct. isRequired isn't part of 1.2 and we're working on updating the designer so it doesn't have the necessity field. |
Thanks @andrewleader. I hate to ask this but, do we have any timeline for the input validation to be available generally ? |
Input validation is expected to be in 1.3, and it's right near the top of our list this time, so it almost certainly should make it. We've been shipping Adaptive Cards in ~6 month cadences, and then there's integration time for partner hosts to integrate the new version of Adaptive Cards into their apps, so maybe in about ~8-9 months input validation should be generally available in MS Teams (but no guarantees). |
Being tracked with #3081 in combination with more advanced validation support |
@andrewleader Any updates on this? |
🔄 Android (#2411)
🔄 iOS (#2412)
✔️ TS (#2413)
🔄 UWP (#2414)
✔️ Designer (#2526)
Solves requests
Summary
Add a
validation
property onInput
elements, which currently only has necessity (so you can mark it as required)Schema
New property on
Input
elements.New
InputValidationOptions
typeIn the future, you can imagine we'll add
regex
to the options.New
InputValidationNecessity
enumrequired
, except this adds a visual cue to indicate the field is required before the user has even interacted with the card.New property on
Action
elements.OPEN QUESTION: Should we also allow authors to provide custom text for the validation error? Maybe that's a vNext feature? Or maybe we do it now? It probably shouldn't be required for authors to provide that text though, there's something nice about not needing to provide that text.
Example
Initial state
User clicks Confirm, we show validation errors (and trigger event to host telling host where it needs to scroll to, in case some of the invalid fields were off-screen)
User changes the input value, we remove the validation error. We'll re-validate upon button press again. So even if they type "a" and then delete it, the validation error should remain removed.
Note that we do NOT place the validation above the input, since it breaks the flow of the header text related to the input. And we can't place the validation above the header text, since inputs don't have a header property.
Other inputs
Host Config
No changes. We'll use the
attention
color for the error text.Host APIs
Hosts need to have APIs similar to below (in the corresponding native style)
Down-level impact
Medium. Authors need to expect that users running down-level can still submit the card with empty inputs (most concerning for new authors who might assume that required property works, existing authors should already have that logic).
Host burden
None. Hosts could choose to native style, but they don't have to.
Renderer Requirements
necessity
is set torequiredWithVisualCue
errorMessage
. If none is specified, that's a parse error (since it's required).Research on best practices
https://blog.prototypr.io/ux-best-practices-of-form-validation-ddb8a0df14fd
https://designmodo.com/ux-form-validation/
https://uxplanet.org/designing-more-efficient-forms-assistance-and-validation-f26a5241199d
https://medium.theuxblog.com/10-best-practices-for-designing-user-friendly-forms-fa0ba7c3e01f
https://uxmovement.com/forms/why-users-make-more-errors-with-instant-inline-validation/
https://baymard.com/blog/inline-form-validation
Auto-generated task status
The text was updated successfully, but these errors were encountered: