Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

datepicker - Auto-submit of the form when showing the calendar #4192

Closed
extrafu opened this issue Aug 16, 2015 · 5 comments
Closed

datepicker - Auto-submit of the form when showing the calendar #4192

extrafu opened this issue Aug 16, 2015 · 5 comments
Assignees
Milestone

Comments

@extrafu
Copy link

extrafu commented Aug 16, 2015

Hello,

Whenever a md-datepicker is added within a <form> ... </form>, it auto-submits the form as soon as the arrow drop down icon is clicked, to actually show the calendar to select a day.

This happens with the latest code.

Thanks,

extrafu added a commit to Alinto/sogo that referenced this issue Aug 17, 2015
…ule (Vacation)

The date picker suffers from this bug: angular/material#4192

Which makes it not that usable right now.
@epelc
Copy link
Contributor

epelc commented Aug 17, 2015

Perhaps type="button" needs to be added to the template.

@extrafu
Copy link
Author

extrafu commented Aug 17, 2015

That patch fixes it for me:

diff --git a/src/components/datepicker/datePicker.js b/src/components/datepicker/datePicker.js
index 9dd7cd6..ec3e180 100644
--- a/src/components/datepicker/datePicker.js
+++ b/src/components/datepicker/datePicker.js
@@ -49,7 +49,7 @@
               'ng-class="{\'md-datepicker-focused\': ctrl.isFocused}">' +
             '<input class="md-datepicker-input" aria-haspopup="true" ' +
                 'ng-focus="ctrl.setFocused(true)" ng-blur="ctrl.setFocused(false)">' +
-            '<md-button md-no-ink class="md-datepicker-triangle-button md-icon-button" ' +
+            '<md-button md-no-ink class="md-datepicker-triangle-button md-icon-button" type="button" ' +
                 'ng-click="ctrl.openCalendarPane($event)" ' +
                 'aria-label="{{::ctrl.dateLocale.msgOpenCalendar}}">' +
               '<div class="md-datepicker-expand-triangle"></div>' +

@extrafu
Copy link
Author

extrafu commented Aug 17, 2015

After further testing, sorry but it does not fix the issue.

@jelbourn jelbourn added this to the 0.11.0 milestone Aug 18, 2015
@jelbourn jelbourn self-assigned this Aug 18, 2015
@jelbourn
Copy link
Member

Definitely should have type="button"

jelbourn added a commit that referenced this issue Aug 18, 2015
@jelbourn
Copy link
Member

Fixed via 314a05d

kennethcachia pushed a commit to kennethcachia/material that referenced this issue Sep 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants