thombruce / toodles

✅ A super simple todo app
https://toodles.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

[Feature]: Add formatting/validation to advanced todo inputs #128

Open thombruce opened 4 weeks ago

thombruce commented 4 weeks ago

Feature request

This mainly concerns price, which right now is a string input. I initially wrote it as a numeric input, but due to lack of formatting it ended up setting a price value without a currency symbol meaning it was no longer recognised as a price when the document was reloaded.

And actually price should permit a price range in the style £1.00-£5.00. We can achieve this either by having two numerical inputs and combining them into a string with a default (or user-provided) currency symbol or... we can maintain a string input and validate its format before submission.

I've tested using the multiplier input. If I write a range into a numeric input (e.g. 7-6 - I also wanted to test if it resulted in subtraction) then the form submission succeeds... the todo shows no multiplier... and the multiplier doesn't clear at submission.

So ranges are invalid in a numeric input and silently fail (maybe (probably) because of nullable and format rules I added to numeric input if it isn't a number).

I think the ideal solution is a new range input that is functionally a numeric input unless the string contains a late - in which case it converts to a "number range" which is functionally... two numeric inputs and a formatting rule to combine the pair.

Code of Conduct