ita-social-projects / ZeroWaste

Waste calculator for Zero Waste Lviv organization
MIT License
10 stars 11 forks source link

Restrict input to two decimal places in price input fields #933

Closed alexy78 closed 2 weeks ago

alexy78 commented 3 weeks ago

Resolves: #817

Code reviewers

Summary of issue

The current implementation of the price input fields allows users to enter an unlimited number of decimal places.

Summary of change

Added a restrictDecimalInput in price_form_controller.js. It won't allow a user to enter more than two decimal places in the price input fields. This method is designed to intercept key down events and prevent further input if the decimal part of the number already has two digits.

Testing approach

CHECK LIST