Angular 2 DateTime Picker Issue
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
add a comment |
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
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
add a comment |
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
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
angular
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
A simple solution that should work.
Instead on ngSubmit method in form, remove it and add the method on click of the submit button.
That did the trick, thanks.
– jmckie
Nov 22 '18 at 9:02
add a comment |
Please add ngNativeValidate in your form tag
add a comment |
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
});
}
});
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
Required, but never shown
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
A simple solution that should work.
Instead on ngSubmit method in form, remove it and add the method on click of the submit button.
That did the trick, thanks.
– jmckie
Nov 22 '18 at 9:02
add a comment |
A simple solution that should work.
Instead on ngSubmit method in form, remove it and add the method on click of the submit button.
That did the trick, thanks.
– jmckie
Nov 22 '18 at 9:02
add a comment |
A simple solution that should work.
Instead on ngSubmit method in form, remove it and add the method on click of the submit button.
A simple solution that should work.
Instead on ngSubmit method in form, remove it and add the method on click of the submit button.
answered Nov 22 '18 at 5:22
Padmapriya VishnuvardhanPadmapriya Vishnuvardhan
772310
772310
That did the trick, thanks.
– jmckie
Nov 22 '18 at 9:02
add a comment |
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
add a comment |
Please add ngNativeValidate in your form tag
add a comment |
Please add ngNativeValidate in your form tag
add a comment |
Please add ngNativeValidate in your form tag
Please add ngNativeValidate in your form tag
answered Nov 22 '18 at 5:33
SUNIL JADHAVSUNIL JADHAV
567
567
add a comment |
add a comment |
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.
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
Required, but never shown
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
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
Required, but never shown
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
Required, but never shown
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
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
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