bsDatepicker not work with Angular form Validation












0















I use the bootstrap datepicker with in my Angular application. I want to add a validation to verify that the date is correct(not "Invalid Date"), but when I have added the formControlName="birthDate" for this control, the calendar didn't work correctly, the days are duplicated on the small popup window, can you tell me how the resolve this problem, please?



<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="form-control input-sm" id="birthDate" name="birthDate"
formControlName="birthDate"
bsDatepicker
[bsConfig]="{dateInputFormat: 'DD/MM/YYYY'}"
[(ngModel)]="response.date"
[disabled]="IsNotModifiable()">
</div>


I have tried to add a attribut (input)=verify() who check the date, but it's never triggered.










share|improve this question





























    0















    I use the bootstrap datepicker with in my Angular application. I want to add a validation to verify that the date is correct(not "Invalid Date"), but when I have added the formControlName="birthDate" for this control, the calendar didn't work correctly, the days are duplicated on the small popup window, can you tell me how the resolve this problem, please?



    <div class="input-group">
    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
    <input type="text" class="form-control input-sm" id="birthDate" name="birthDate"
    formControlName="birthDate"
    bsDatepicker
    [bsConfig]="{dateInputFormat: 'DD/MM/YYYY'}"
    [(ngModel)]="response.date"
    [disabled]="IsNotModifiable()">
    </div>


    I have tried to add a attribut (input)=verify() who check the date, but it's never triggered.










    share|improve this question



























      0












      0








      0








      I use the bootstrap datepicker with in my Angular application. I want to add a validation to verify that the date is correct(not "Invalid Date"), but when I have added the formControlName="birthDate" for this control, the calendar didn't work correctly, the days are duplicated on the small popup window, can you tell me how the resolve this problem, please?



      <div class="input-group">
      <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
      <input type="text" class="form-control input-sm" id="birthDate" name="birthDate"
      formControlName="birthDate"
      bsDatepicker
      [bsConfig]="{dateInputFormat: 'DD/MM/YYYY'}"
      [(ngModel)]="response.date"
      [disabled]="IsNotModifiable()">
      </div>


      I have tried to add a attribut (input)=verify() who check the date, but it's never triggered.










      share|improve this question
















      I use the bootstrap datepicker with in my Angular application. I want to add a validation to verify that the date is correct(not "Invalid Date"), but when I have added the formControlName="birthDate" for this control, the calendar didn't work correctly, the days are duplicated on the small popup window, can you tell me how the resolve this problem, please?



      <div class="input-group">
      <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
      <input type="text" class="form-control input-sm" id="birthDate" name="birthDate"
      formControlName="birthDate"
      bsDatepicker
      [bsConfig]="{dateInputFormat: 'DD/MM/YYYY'}"
      [(ngModel)]="response.date"
      [disabled]="IsNotModifiable()">
      </div>


      I have tried to add a attribut (input)=verify() who check the date, but it's never triggered.







      angular bootstrap-4 bootstrap-datepicker angular-validation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 9:55









      piet.t

      10.1k73246




      10.1k73246










      asked Nov 23 '18 at 9:34









      pierrepierre

      54110




      54110
























          1 Answer
          1






          active

          oldest

          votes


















          0














          <div class="input-group mb-3">
          <input [(ngModel)]="Date" placeholder="MM/DD/YYYY" class="form-control" formControlName="Date" #dateneeded ="bsDatepicker" bsDatepicker [bsConfig]="datepickerConfig">
          <div class="input-group-append">
          <span class="input-group-text" (click)="dateneeded.show()">
          <i class="far fa-calendar-plus" value="open"></i>
          </span>
          </div>
          </div>


          this piece of code is working for me. Make sure you have imported bsdatepicker module in appmodule.ts






          share|improve this answer
























          • Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

            – pierre
            Nov 23 '18 at 13:13











          • can you create a working demo of your problem?

            – Deepak Verma
            Nov 23 '18 at 13:14











          • Sorry, i have no idea to create a demo

            – pierre
            Nov 23 '18 at 15:24












          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',
          autoActivateHeartbeat: false,
          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%2f53443985%2fbsdatepicker-not-work-with-angular-form-validation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          <div class="input-group mb-3">
          <input [(ngModel)]="Date" placeholder="MM/DD/YYYY" class="form-control" formControlName="Date" #dateneeded ="bsDatepicker" bsDatepicker [bsConfig]="datepickerConfig">
          <div class="input-group-append">
          <span class="input-group-text" (click)="dateneeded.show()">
          <i class="far fa-calendar-plus" value="open"></i>
          </span>
          </div>
          </div>


          this piece of code is working for me. Make sure you have imported bsdatepicker module in appmodule.ts






          share|improve this answer
























          • Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

            – pierre
            Nov 23 '18 at 13:13











          • can you create a working demo of your problem?

            – Deepak Verma
            Nov 23 '18 at 13:14











          • Sorry, i have no idea to create a demo

            – pierre
            Nov 23 '18 at 15:24
















          0














          <div class="input-group mb-3">
          <input [(ngModel)]="Date" placeholder="MM/DD/YYYY" class="form-control" formControlName="Date" #dateneeded ="bsDatepicker" bsDatepicker [bsConfig]="datepickerConfig">
          <div class="input-group-append">
          <span class="input-group-text" (click)="dateneeded.show()">
          <i class="far fa-calendar-plus" value="open"></i>
          </span>
          </div>
          </div>


          this piece of code is working for me. Make sure you have imported bsdatepicker module in appmodule.ts






          share|improve this answer
























          • Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

            – pierre
            Nov 23 '18 at 13:13











          • can you create a working demo of your problem?

            – Deepak Verma
            Nov 23 '18 at 13:14











          • Sorry, i have no idea to create a demo

            – pierre
            Nov 23 '18 at 15:24














          0












          0








          0







          <div class="input-group mb-3">
          <input [(ngModel)]="Date" placeholder="MM/DD/YYYY" class="form-control" formControlName="Date" #dateneeded ="bsDatepicker" bsDatepicker [bsConfig]="datepickerConfig">
          <div class="input-group-append">
          <span class="input-group-text" (click)="dateneeded.show()">
          <i class="far fa-calendar-plus" value="open"></i>
          </span>
          </div>
          </div>


          this piece of code is working for me. Make sure you have imported bsdatepicker module in appmodule.ts






          share|improve this answer













          <div class="input-group mb-3">
          <input [(ngModel)]="Date" placeholder="MM/DD/YYYY" class="form-control" formControlName="Date" #dateneeded ="bsDatepicker" bsDatepicker [bsConfig]="datepickerConfig">
          <div class="input-group-append">
          <span class="input-group-text" (click)="dateneeded.show()">
          <i class="far fa-calendar-plus" value="open"></i>
          </span>
          </div>
          </div>


          this piece of code is working for me. Make sure you have imported bsdatepicker module in appmodule.ts







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 11:30









          Deepak VermaDeepak Verma

          449115




          449115













          • Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

            – pierre
            Nov 23 '18 at 13:13











          • can you create a working demo of your problem?

            – Deepak Verma
            Nov 23 '18 at 13:14











          • Sorry, i have no idea to create a demo

            – pierre
            Nov 23 '18 at 15:24



















          • Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

            – pierre
            Nov 23 '18 at 13:13











          • can you create a working demo of your problem?

            – Deepak Verma
            Nov 23 '18 at 13:14











          • Sorry, i have no idea to create a demo

            – pierre
            Nov 23 '18 at 15:24

















          Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

          – pierre
          Nov 23 '18 at 13:13





          Thanks, but it doesn't work, when i place the mouse on the popup calendar, i will have many times 2 2 2 3 3 4 4 4... i don't know why, but i think it's related to the binding (formControlName="")

          – pierre
          Nov 23 '18 at 13:13













          can you create a working demo of your problem?

          – Deepak Verma
          Nov 23 '18 at 13:14





          can you create a working demo of your problem?

          – Deepak Verma
          Nov 23 '18 at 13:14













          Sorry, i have no idea to create a demo

          – pierre
          Nov 23 '18 at 15:24





          Sorry, i have no idea to create a demo

          – pierre
          Nov 23 '18 at 15:24




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443985%2fbsdatepicker-not-work-with-angular-form-validation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          RAC Tourist Trophy