Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datepick doesn't work properly in form #4530

Closed
ghost opened this issue May 13, 2017 · 2 comments · Fixed by #4531
Closed

datepick doesn't work properly in form #4530

ghost opened this issue May 13, 2017 · 2 comments · Fixed by #4531
Assignees

Comments

@ghost
Copy link

ghost commented May 13, 2017

Bug, feature request, or proposal:

bug

What is the expected behavior?

when i click the calendar button, pop up the calendar,and select the date

What is the current behavior?

when i click the calendar button, the form ngSubmit function will be exec

What are the steps to reproduce?

just put a Datepicker component in form

<md-dialog-content>
    <form (ngSubmit)="onSubmit()" #dialogForm="ngForm"> 
        <md-input-container>
            <input mdInput [mdDatepicker]="myDatepicker" name="mydatep">
            <button mdSuffix [mdDatepickerToggle]="myDatepicker"></button>
        </md-input-container>
        <md-datepicker #myDatepicker [touchUi]="true"></md-datepicker>      
        
        <md-dialog-actions [attr.align]="actionsAlignment">
            <button md-raised-button color="primary" md-dialog-close (click)="dialogClose()"> Close </button>
            <button type="submit" md-raised-button color="accent" [disabled]="!dialogForm.form.valid"> OK </button>
        </md-dialog-actions>   
    </form>
</md-dialog-content>

What is the use-case or motivation for changing an existing behavior?

It isn't working properly in form, and it is work properly outside form

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.2.0-beta.0
material 2.0.0-beta.5
os win10
typescript 2.3.1
Browsers: Chrome 58.0.3029.110 (64-bit)

Is there anything else we should know?

@crisbeto crisbeto self-assigned this May 13, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue May 13, 2017
Prevents the toggle for the datepicker's calendar from submitting its parent form.

Fixes angular#4530.
crisbeto added a commit to crisbeto/material2 that referenced this issue May 13, 2017
Prevents the toggle for the datepicker's calendar from submitting its parent form.

Fixes angular#4530.
@yoanasdrubal
Copy link

I Fix that problem using type attribute in button date picker
<button type="button" mdSuffix [mdDatepickerToggle]="picker">

jelbourn pushed a commit that referenced this issue May 15, 2017
Prevents the toggle for the datepicker's calendar from submitting its parent form.

Fixes #4530.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants