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:




  1. User should be shown a tooltip when he hovers over the disabled button (i.e he has not filled in the mandatory details).

  2. 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.submitButtonDisabledstate 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.










share|improve this question




























    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:




    1. User should be shown a tooltip when he hovers over the disabled button (i.e he has not filled in the mandatory details).

    2. 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.submitButtonDisabledstate 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.










    share|improve this question


























      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:




      1. User should be shown a tooltip when he hovers over the disabled button (i.e he has not filled in the mandatory details).

      2. 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.submitButtonDisabledstate 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.










      share|improve this question















      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:




      1. User should be shown a tooltip when he hovers over the disabled button (i.e he has not filled in the mandatory details).

      2. 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.submitButtonDisabledstate 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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago

























      asked 2 days ago









      LearnToLive

      96311




      96311





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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




















































































          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues