-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Use tooltip for form validation #186
Comments
Updated the comment to remove issue that was my bad. |
@oyeanuj I add a new option
So to summarize:
|
Thanks for @cklab 's suggestion, that's more react style. Since See README https://github.com/wwayne/react-tooltip#2-hide-tooltip-when-getcontent-returns-null-or-undefined and Release log https://github.com/wwayne/react-tooltip/releases/tag/3.2.1 |
@wwayne Regarding your README, I just checked out 3.2.1 and have a component that has |
@cklab Yes my bad, 'true' needed to be set only when returning undefined or empty children, thanks for the Correction |
@wwayne So, I was finally back to this project to implement your suggestion above. All of the above works well so far - thank you! One last thing - I am looking to close the tooltip if the user clicks elsewhere on the screen, rather than when the user hovers away. How do you suggest doing it? I tried |
@oyeanuj
|
@wwayne Always appreciate the quick response! Couple of questions around that -
|
|
@wwayne Thanks for that. Setting everything up works for all cases but one that I mentioned originally. The In my case, if there is a validation error, I want it to pop up on an adjoining element or the button without the use needing to interact with that element? Is that possible using |
@oyeanuj Yes, you can use |
Hi @wwayne, back with some more questions :)
I am trying to use the tooltips to show validation error messages for my forms, like in the screenshot below. Essentially, once a user clicks on the 'Submit' button, if there is an error, then show it in the tooltip, in context.
I was thinking to use the static methods to show it in case of errors, but I am running into a couple of issues while trying to implement this.
onClick
is already being used for submitting the form? I would like it be shown afteronClick
if there is an error? In the code below, I try to do the same but it doesn't show up the first time I click on the button. I have to click on the button again for the tooltip to show up.data-tip
conditional which almost worked but it shows an empty tooltip when there should be no tooltip. Code belowIs there any other alternative that you can think of to invoke the tooltip in such a case? Essentially, is there a way to make the tooltip render conditionally?
Any thoughts would be very appreciated, thank you!
The text was updated successfully, but these errors were encountered: