Closed mtancoigne closed 1 year ago
having a small step by default would do the trick (e.g.:
0.1
) ?
Hmmm -- That's a great idea!
In the future I'll probably also allow for a callback hook so that people can further style fields to their liking. But for the meantime I'll implement your suggestion for :float
, and it will become a part of v1.0.112. Most likely will complete the other small things for this update this evening, so by tomorrow morning should have this update available.
Out of curiosity -- what database engine do you use? (Postgres / MySQL / Oracle / etc)
At least on Firefox, a input type
number
without astep
attribute is considered an int, and invalid with a float
Manuel,
Have now fixed this issue in release 1.0.112 of The Brick.
Had tried a couple different options, at first the step
approach you described, and seeing limitations with monetary things then ended up using this RegEx validator with HTML5's pattern
attribute and checkValidity
:
\d*(?:\.\d*|)
This allows decimal and float entries with any number of digits. It does not support exponential notation though, which may be an issue -- will be exploring more to see if ultra-small or ultra-large numbers run into trouble.
I do have plans to eventually provide custom hooks both client-side and server-side that would allow rendering the <input>
(or other HTML) for any control in custom ways. Will let you know when that's implemented.
Thanks so much for reaching out, and welcome all feedback that you have!
-Lorin
Hi,
First of all, thanks for your quick reply!
Out of curiosity -- what database engine do you use? (Postgres / MySQL / Oracle / etc)
As it was on a small proof of concept, I was testing with SQLite3.
For the hook idea, I'm not really well placed to give my opinion: if I use Brick in the future, it will be a sidekick for development before writing the proper MVC. So declaring too much things will make me do the job twice. (that's why I don't use admin solutions as everytime I tried, I spent more time trying to tweek the gems as coding it myself).
For now, Brick does what I was expecting, and that's really cool :)
Brick ... will be a sidekick for development before writing the proper MVC.
This is one primary use case that I had envisioned for Brick -- have it while starting out, and then little by little you can keep adding code to a project. Along the way you can use Brick to fill in the gaps while you build. Then eventually everything is written and the auto-scaffolding of Brick can be removed, leaving a finished product.
(There are other use cases as well, which is why I'll eventually offer ability to customise.)
Thanks for your feedback, Manuel. Reach out whenever you like!
Hi, I'm currently testing Brick and noted that on forms, a
float
field has an input like:At least on Firefox, a input type
number
without astep
attribute is considered an int, and invalid with a float. Maybe having a small step by default would do the trick (e.g.:0.1
) ?