Angular 2 DateTime Picker Issue












0















I'm wondering if anyone has had this issue before? I'm using the Angular 2 DateTime picker (https://cuppalabs.github.io/angular2-datetimepicker/#/datetimepicker). I have the DateTime picker inside a form and when I go to choose a time and set it, the form is being submitted for some reason. The form is attached to ngSubmit, but I am not submitting the form?



  // Inside form
<div class="form-group">
<label for="farm-harvest">Harvest</label>
<angular2-date-picker class="form-control" [(ngModel)]="date" formControlName="farmHarvest" [settings]="settings"></angular2-date-picker>
</div>

// Default options being set
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: true,
format: 'medium',
defaultOpen: false
};









share|improve this question























  • a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

    – Akber Iqbal
    Nov 22 '18 at 4:42











  • 'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

    – wannadream
    Nov 22 '18 at 4:43











  • Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

    – jmckie
    Nov 22 '18 at 4:46











  • unsee.cc/3de1c623

    – wannadream
    Nov 22 '18 at 4:49
















0















I'm wondering if anyone has had this issue before? I'm using the Angular 2 DateTime picker (https://cuppalabs.github.io/angular2-datetimepicker/#/datetimepicker). I have the DateTime picker inside a form and when I go to choose a time and set it, the form is being submitted for some reason. The form is attached to ngSubmit, but I am not submitting the form?



  // Inside form
<div class="form-group">
<label for="farm-harvest">Harvest</label>
<angular2-date-picker class="form-control" [(ngModel)]="date" formControlName="farmHarvest" [settings]="settings"></angular2-date-picker>
</div>

// Default options being set
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: true,
format: 'medium',
defaultOpen: false
};









share|improve this question























  • a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

    – Akber Iqbal
    Nov 22 '18 at 4:42











  • 'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

    – wannadream
    Nov 22 '18 at 4:43











  • Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

    – jmckie
    Nov 22 '18 at 4:46











  • unsee.cc/3de1c623

    – wannadream
    Nov 22 '18 at 4:49














0












0








0








I'm wondering if anyone has had this issue before? I'm using the Angular 2 DateTime picker (https://cuppalabs.github.io/angular2-datetimepicker/#/datetimepicker). I have the DateTime picker inside a form and when I go to choose a time and set it, the form is being submitted for some reason. The form is attached to ngSubmit, but I am not submitting the form?



  // Inside form
<div class="form-group">
<label for="farm-harvest">Harvest</label>
<angular2-date-picker class="form-control" [(ngModel)]="date" formControlName="farmHarvest" [settings]="settings"></angular2-date-picker>
</div>

// Default options being set
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: true,
format: 'medium',
defaultOpen: false
};









share|improve this question














I'm wondering if anyone has had this issue before? I'm using the Angular 2 DateTime picker (https://cuppalabs.github.io/angular2-datetimepicker/#/datetimepicker). I have the DateTime picker inside a form and when I go to choose a time and set it, the form is being submitted for some reason. The form is attached to ngSubmit, but I am not submitting the form?



  // Inside form
<div class="form-group">
<label for="farm-harvest">Harvest</label>
<angular2-date-picker class="form-control" [(ngModel)]="date" formControlName="farmHarvest" [settings]="settings"></angular2-date-picker>
</div>

// Default options being set
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: true,
format: 'medium',
defaultOpen: false
};






angular






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 4:39









jmckiejmckie

969




969













  • a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

    – Akber Iqbal
    Nov 22 '18 at 4:42











  • 'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

    – wannadream
    Nov 22 '18 at 4:43











  • Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

    – jmckie
    Nov 22 '18 at 4:46











  • unsee.cc/3de1c623

    – wannadream
    Nov 22 '18 at 4:49



















  • a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

    – Akber Iqbal
    Nov 22 '18 at 4:42











  • 'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

    – wannadream
    Nov 22 '18 at 4:43











  • Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

    – jmckie
    Nov 22 '18 at 4:46











  • unsee.cc/3de1c623

    – wannadream
    Nov 22 '18 at 4:49

















a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

– Akber Iqbal
Nov 22 '18 at 4:42





a minimal working example on stackblitz will help... to quote my personal experience: many a time, when i try to replicate a single issue in its minimal form, the issue becomes clear

– Akber Iqbal
Nov 22 '18 at 4:42













'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

– wannadream
Nov 22 '18 at 4:43





'Set Time' button has no specific type, hence, it is 'submit' by default. Please contact the developer of that component or you customize it yourself.

– wannadream
Nov 22 '18 at 4:43













Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

– jmckie
Nov 22 '18 at 4:46





Can you clarify how you found that out please wannadream, been looking at this for a while now. Thanks

– jmckie
Nov 22 '18 at 4:46













unsee.cc/3de1c623

– wannadream
Nov 22 '18 at 4:49





unsee.cc/3de1c623

– wannadream
Nov 22 '18 at 4:49












2 Answers
2






active

oldest

votes


















1














A simple solution that should work.



Instead on ngSubmit method in form, remove it and add the method on click of the submit button.






share|improve this answer
























  • That did the trick, thanks.

    – jmckie
    Nov 22 '18 at 9:02



















0














Please add ngNativeValidate in your form tag






share|improve this answer























    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%2f53423983%2fangular-2-datetime-picker-issue%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    A simple solution that should work.



    Instead on ngSubmit method in form, remove it and add the method on click of the submit button.






    share|improve this answer
























    • That did the trick, thanks.

      – jmckie
      Nov 22 '18 at 9:02
















    1














    A simple solution that should work.



    Instead on ngSubmit method in form, remove it and add the method on click of the submit button.






    share|improve this answer
























    • That did the trick, thanks.

      – jmckie
      Nov 22 '18 at 9:02














    1












    1








    1







    A simple solution that should work.



    Instead on ngSubmit method in form, remove it and add the method on click of the submit button.






    share|improve this answer













    A simple solution that should work.



    Instead on ngSubmit method in form, remove it and add the method on click of the submit button.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 '18 at 5:22









    Padmapriya VishnuvardhanPadmapriya Vishnuvardhan

    772310




    772310













    • That did the trick, thanks.

      – jmckie
      Nov 22 '18 at 9:02



















    • That did the trick, thanks.

      – jmckie
      Nov 22 '18 at 9:02

















    That did the trick, thanks.

    – jmckie
    Nov 22 '18 at 9:02





    That did the trick, thanks.

    – jmckie
    Nov 22 '18 at 9:02













    0














    Please add ngNativeValidate in your form tag






    share|improve this answer




























      0














      Please add ngNativeValidate in your form tag






      share|improve this answer


























        0












        0








        0







        Please add ngNativeValidate in your form tag






        share|improve this answer













        Please add ngNativeValidate in your form tag







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 5:33









        SUNIL JADHAVSUNIL JADHAV

        567




        567






























            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%2f53423983%2fangular-2-datetime-picker-issue%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

            Costa Masnaga

            Fotorealismo

            Sidney Franklin