Reactstrap tooltip enable/disable based on state of the button
up vote
1
down vote
favorite
I am using Reactstrap (version 6.5.0) for styling of my ReactJs project.
I have an inline form which has a submit button. This button is disabled until the user has entered the mandatory details in the form.
What I am trying to achieve is the following:
- User should be shown a
tooltip
when he hovers over the disabled button (i.e he has not filled in the mandatory details). - When he fills in the mandatory details, the tooltip should no longer be shown on the submit button.
I am using Reactstrap UncontrolledTooltip
component as follows
<button id="submitButton" type="submit" onClick={this.onSubmit} className="btn" disabled={this.state.submitButtonDisabled}>Submit</button>
{ this.state.submitButtonDisabled &&
<UncontrolledTooltip placement="bottom" target="submitButton">
Please fill in the mandatory details
</UncontrolledTooltip>
}
My component has this.state.submitButtonDisabled
state which I toggle based on whether all the mandory feilds are filled in.
However, what is happening is that the tooltip
is not shown on hover over the disabled submit
button. It is only shown when I try to click the disabled submit
button a few times.
Also, once the mandatory details have been filled in and submit
button becomes enabled, tooltip
keeps on showing even then on hover.
Edited : I also noticed that clicking the submit button also gives below warning in the console
index.js:1452 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
How can I achieve the expected behaviour using Reactstrap (I don't want to use jquery just for the tooltip)
Any help would be highly appreciated.
Thanks.
javascript reactjs bootstrap-4 reactstrap
add a comment |
up vote
1
down vote
favorite
I am using Reactstrap (version 6.5.0) for styling of my ReactJs project.
I have an inline form which has a submit button. This button is disabled until the user has entered the mandatory details in the form.
What I am trying to achieve is the following:
- User should be shown a
tooltip
when he hovers over the disabled button (i.e he has not filled in the mandatory details). - When he fills in the mandatory details, the tooltip should no longer be shown on the submit button.
I am using Reactstrap UncontrolledTooltip
component as follows
<button id="submitButton" type="submit" onClick={this.onSubmit} className="btn" disabled={this.state.submitButtonDisabled}>Submit</button>
{ this.state.submitButtonDisabled &&
<UncontrolledTooltip placement="bottom" target="submitButton">
Please fill in the mandatory details
</UncontrolledTooltip>
}
My component has this.state.submitButtonDisabled
state which I toggle based on whether all the mandory feilds are filled in.
However, what is happening is that the tooltip
is not shown on hover over the disabled submit
button. It is only shown when I try to click the disabled submit
button a few times.
Also, once the mandatory details have been filled in and submit
button becomes enabled, tooltip
keeps on showing even then on hover.
Edited : I also noticed that clicking the submit button also gives below warning in the console
index.js:1452 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
How can I achieve the expected behaviour using Reactstrap (I don't want to use jquery just for the tooltip)
Any help would be highly appreciated.
Thanks.
javascript reactjs bootstrap-4 reactstrap
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am using Reactstrap (version 6.5.0) for styling of my ReactJs project.
I have an inline form which has a submit button. This button is disabled until the user has entered the mandatory details in the form.
What I am trying to achieve is the following:
- User should be shown a
tooltip
when he hovers over the disabled button (i.e he has not filled in the mandatory details). - When he fills in the mandatory details, the tooltip should no longer be shown on the submit button.
I am using Reactstrap UncontrolledTooltip
component as follows
<button id="submitButton" type="submit" onClick={this.onSubmit} className="btn" disabled={this.state.submitButtonDisabled}>Submit</button>
{ this.state.submitButtonDisabled &&
<UncontrolledTooltip placement="bottom" target="submitButton">
Please fill in the mandatory details
</UncontrolledTooltip>
}
My component has this.state.submitButtonDisabled
state which I toggle based on whether all the mandory feilds are filled in.
However, what is happening is that the tooltip
is not shown on hover over the disabled submit
button. It is only shown when I try to click the disabled submit
button a few times.
Also, once the mandatory details have been filled in and submit
button becomes enabled, tooltip
keeps on showing even then on hover.
Edited : I also noticed that clicking the submit button also gives below warning in the console
index.js:1452 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
How can I achieve the expected behaviour using Reactstrap (I don't want to use jquery just for the tooltip)
Any help would be highly appreciated.
Thanks.
javascript reactjs bootstrap-4 reactstrap
I am using Reactstrap (version 6.5.0) for styling of my ReactJs project.
I have an inline form which has a submit button. This button is disabled until the user has entered the mandatory details in the form.
What I am trying to achieve is the following:
- User should be shown a
tooltip
when he hovers over the disabled button (i.e he has not filled in the mandatory details). - When he fills in the mandatory details, the tooltip should no longer be shown on the submit button.
I am using Reactstrap UncontrolledTooltip
component as follows
<button id="submitButton" type="submit" onClick={this.onSubmit} className="btn" disabled={this.state.submitButtonDisabled}>Submit</button>
{ this.state.submitButtonDisabled &&
<UncontrolledTooltip placement="bottom" target="submitButton">
Please fill in the mandatory details
</UncontrolledTooltip>
}
My component has this.state.submitButtonDisabled
state which I toggle based on whether all the mandory feilds are filled in.
However, what is happening is that the tooltip
is not shown on hover over the disabled submit
button. It is only shown when I try to click the disabled submit
button a few times.
Also, once the mandatory details have been filled in and submit
button becomes enabled, tooltip
keeps on showing even then on hover.
Edited : I also noticed that clicking the submit button also gives below warning in the console
index.js:1452 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
How can I achieve the expected behaviour using Reactstrap (I don't want to use jquery just for the tooltip)
Any help would be highly appreciated.
Thanks.
javascript reactjs bootstrap-4 reactstrap
javascript reactjs bootstrap-4 reactstrap
edited 2 days ago
asked 2 days ago
LearnToLive
96311
96311
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238508%2freactstrap-tooltip-enable-disable-based-on-state-of-the-button%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password