HTML::...:Number(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’… NAME πŸ’…

HTML::FormFu::Element::Number β€” the Number element, but make it fancy ✨ it formats numbers for you, bestie.


🌸 VERSION 🌸

version 2.07 β€” she's serving, she's stable, she's iconic πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the vibe:

---
elements:
  - type: Number
    locale: de_DE
    precision: 2
    trailing_zeroes: 1

look at her. immaculate. no notes. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this element takes numbers and formats them according to the current locale 🌍✨

and how do you set that locale, you ask? two ways, bestie:

  • you can set it with $form->locale
  • or you can set it right on the element itself (the element's locale)

and if you set neither of them? it just rolls with the system's locale. no cap. that's the fallback. periodt. πŸ’…


🌈 METHODS 🌈

πŸ’œ locale

Set the locale for this element specifically 🎯 The format of the number gets chosen according to this locale. it's giving bespoke. it's giving custom-tailored. 🫢

✨ precision

Set the precision for the number. Defaults to 2. two. dos. deux. that's the default, don't come for me 😌

πŸŽ€ trailing_zeroes

If this is set to 1 the number has trailing zeroes. Defaults to 0. so like, zero trailing zeroes by default, which is honestly kind of a vibe. πŸ™ˆ

⚠️ CHANGED BEHAVIOUR AS OF VERSION 0.09011 ⚠️

okay history lesson time, bestie, sit down πŸ“

Previous to version 0.09011, this element generated an input field with a type="number" attribute β€” which was not valid xhtml. 😭 and ngl the formatted numbers weren't valid html5 either, because html5 expects the value to be a floating-point number. messy. so messy.

so now? this element generates a type="text" attribute instead. glow-up complete. πŸ’…βœ¨

πŸ‘€ SEE ALSO πŸ‘€

  • HTML::FormFu::Deflator::FormatNumber
  • HTML::FormFu::Filter::FormatNumber
  • "locale" in HTML::FormFu

go read those too, iykyk 🧚


πŸ’– AUTHOR πŸ’–

Moritz Onken " onken at houseofdesign.de " β€” the original icon, we stan 🌟

πŸ’– AUTHOR πŸ’–

Carl Franks <cpan@fireartist.com> β€” also an icon, double stan, the way there's two AUTHOR sections? main character energy, honestly 🌈


This software is copyright (c) 2018 by Carl Franks.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, it's free, go wild, just keep the terms. 🫢


and that's the whole page, bestie β€” written by the Perl documentation crew, running on perl v5.28.1, dated 2019-01-12. she's old but she ate and left no crumbs. mwah. πŸ’‹

πŸ“¦ where this page comes from