Uri Gross
Uri Gross

Reputation: 524

Cannot submit Angular form to Local email Client

Blockquote

Target: Trying to submit form through angular to Local user's Email Client. I press submit and nothing happens. No error messages.

I tried searching on the net but every solution involves submitting to server side through function with http which is not what I am searching. I need to use "mailto:", "POST" commands.

Update: The problem is that on the css the submit button was under another input field so I could not press it with my mouse. I am a newbe so now I know something new with elements.

Some code ( Please tell me if more code is needed).

<div class="background-wallpaper">
    <form action="mailto:example@com" method="POST" enctype="multipart/form-data" name="EmaiTestForm">
        <h1>צור עמנו קשר</h1>
        <div class="first-name">
            <mat-form-field appearance="fill">
                <input matInput type="text" placeholder="שם פרטי" [formControl]="firstName" required name="firstName"
                    autofocus>
                <mat-error *ngIf="firstName.invalid">{{getFirstNameErrorMessage()}}</mat-error>
            </mat-form-field>
        </div>
        <div class="last-name">
            <mat-form-field appearance="fill">
                <input matInput type="text" placeholder="שם משפחה" [formControl]="lastName" required name="lastName">
                <mat-error *ngIf="lastName.invalid">{{getLastNameErrorMessage()}}</mat-error>
            </mat-form-field>
        </div>
        <div class="telephone">
            <mat-form-field appearance="fill">
                <input matInput type="text" placeholder="טלפון" [formControl]="telephone" required name="telephone">
                <mat-error *ngIf="telephone.invalid">{{getTelephoneErrorMessage()}}</mat-error>
            </mat-form-field>
        </div>

        <div class="email-container">
            <mat-form-field appearance="fill">
                <input matInput type="email" placeholder="כתובת מייל" [formControl]="email" required name="email">
                <mat-error *ngIf="email.invalid">{{getEmailErrorMessage()}}</mat-error>
            </mat-form-field>
        </div>
        <button type="submit" class="btn btn-primary btn-raised">שלח</button>
</form>

Upvotes: 0

Views: 254

Answers (1)

Ashot Aleqsanyan
Ashot Aleqsanyan

Reputation: 4453

I am not sure. But I think you need to add ngNoForm attribute on your form for tell angular it is not the angular form.

like this

<form ngNoForm action="mailto:example@com" method="POST" enctype="multipart/form-data" name="EmaiTestForm">
....
</form>

Please have a look at the screenshot. it iss the phase from ngForm documentation enter image description here

for more info Please go by this url

I hope this can help you.

Upvotes: 2

Related Questions