-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
'+ new item' allows negative numbers. #824
Comments
Do you agree @jkleinsc with this issue? |
@marcorosas1991 I agree... you shouldn't be able to enter in a negative value. |
Ok sounds good. I'll work on it. @tangollama |
@jkleinsc I updated the quantity field in the inventory model, and it works. The form is not submitted when there is a negative quantity. I found an issue with this solution. There is not a visual feedback about the error. I look around and found https://github.com/HospitalRun/hospitalrun-frontend/blob/master/app/components/quantity-conv.js lines 29-47 determine if there is an error with the quantity and add a CSS class. I thought I could check here if the number is negative, but if I'm right, this change would apply to all quantities. Is there any use case when the quantity can be negative? Probably users won't input negative values too often, but it is nice to have the right feedback about it. Thanks! Form is not submitted.No visual feed back on quantity field. |
@marcorosas1991 there isn't anywhere in the app where a negative number should be used, so it would be fine to modify https://github.com/HospitalRun/hospitalrun-frontend/blob/master/app/components/quantity-conv.js#L33 to check for negative numbers. Thanks for working on this issue! |
Is there a reason for allowing negative quantities when adding a new item on the system?
Playing with the form, it doesn't accept 0 as a quantity, but it allows negative numbers.
Expected behavior:
It should prevent entering negative numbers on the form.
Actual behavior:
Negative numbers can be inputted on 'new item form', and saved to inventory.
Steps to reproduce:
Screenshots (if applicable):
OS and Browser:
Chrome Version 54.0.2840.98 (64-bit)
MacOS 10.12.1
The text was updated successfully, but these errors were encountered: