Skip to content

Commit

Permalink
fix: submit a promotion code by pressing enter (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber authored Oct 26, 2020
1 parent c0091ea commit 360b649
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- display addToOrderTemplate Icon/animated Icon or link-->
<button
type="submit"
type="button"
name="addProduct"
class="btn"
[ngClass]="class"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- display addToCart Icon/animated Icon or link-->
<button
type="submit"
type="button"
name="addProduct"
class="btn btn-link add-to-wishlist"
(click)="openModal(modal)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
<div class="form-inline" [ngbCollapse]="isCollapsed">
<input
[formControl]="codeInput"
(keydown.enter)="submitPromotionCode()"
class="form-control"
type="text"
[maxlength]="codeMaxLength"
[placeholder]="'shopping_cart.promotional_code.label' | translate"
/>
<button type="submit" class="btn btn-secondary" [disabled]="!codeInput.valid" (click)="submitPromotionCode()">
<button type="button" class="btn btn-secondary" [disabled]="!codeInput.valid" (click)="submitPromotionCode()">
{{ 'shopping_cart.promotion.apply.button.label' | translate }}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export class BasketPromotionCodeComponent implements OnInit, OnDestroy {
this.lastEnteredPromoCode = this.codeInput.value;
}
this.checkoutFacade.addPromotionCodeToBasket(this.codeInput.value);
// prevent further form submit
return false;
}

ngOnDestroy() {
Expand Down

0 comments on commit 360b649

Please sign in to comment.