-
Notifications
You must be signed in to change notification settings - Fork 408
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
Restricting input to only letters. #33
Comments
Unfortunately there's no way to do this at the moment and it's not something I plan on supporting in the current API. My goal with v1.0 is to provide a much more flexible API that allows developers much more control over the individual pieces of the component, including this use case. I don't currently have a timeline for when I'll release that yet, however. |
I managed to workaround the issue by adding a function prop to the component that reduces the input change to only contain valid letters. Would be open to a PR on the new functionality? |
This feels like a pretty specific use-case to me, so I'd prefer not to support it in the current API and instead make the component more flexible as mentioned above. Thanks for raising the issue and offering to submit a PR, though. |
There is on thing to consider though, is things like zip code search. We only want 5 numeric values. There could be a regex/function for input verification |
Do you mind posting an example of how you'd do it with a raw text input? |
For a react module, I'd create a inputValidation property & if present on text change verify that the input matched the validation (I'd use regex personally). There is also an argument for a masked input usage though as it's clearer for the user to see. |
Could you use |
Closing this out in favor of the broader #79, which should address this use-case. The addition of |
Hi.
Any idea on how i could restrict the input to this component to be only letters? So far i have tried connecting it to a redux-form-field that is hooked up to a reducer to remove all fields that are not letters.
TypeAhead selected={reduxField.value? [{name: reduxField.value}]: []} onInputChange={value=> reduxField.onChange(value)}
However, I am still able to write in digits in the textfield, although they will get deleted as soon as i type in a valid character it seems a bit odd to me. Any idea on how i could completely restrict the input to the textfield?
The text was updated successfully, but these errors were encountered: