Summary: | Validation problems with form field type "number" (decimal separator) | ||
---|---|---|---|
Product: | Koha | Reporter: | Marc Véron <veron> |
Component: | Architecture, internals, and plumbing | Assignee: | Galen Charlton <gmcharlt> |
Status: | NEW --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | castro8583bennett, fridolin.somers, jonathan.druart, marjorie.barry-vila, martin.renvoize, patrick.robitaille |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12310 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17462 |
||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 21507 | ||
Bug Blocks: |
Description
Marc Véron
2016-08-10 06:28:19 UTC
More information: Discussion on IRC: http://irc.koha-community.org/koha/2016-08-09#i_1847065 Bug 12310 - Accept different monetary formats as input Files with input type "numeric" (git grep --files-with-matches 'type="number"'): Decimal: koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt Only digits (no problem): koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt We are currently running into this - it's irritating for the libraries tht sometimes you have to use . and other times you have to use , - There is a lot of error potential if you are not careful. Updating severity a bit. At the moment this problem exists in 2 files: maninvoice.tt and mancredit.tt. Pasting the fix we did on our installations here for making a proper patch later: --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -70,7 +70,7 @@ type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.li <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li> <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li> <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li> - <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li> + <li><label for="amount">Amount: </label><input type="text" pattern="\d+(\.\d{2})?" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li> </ol></fieldset> <fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset> </form> I do not recreate, on /members/maninvoice.pl?borrowernumber=5, I tried with FF ESR 45.4.0 and Chromium 55.0.2883.75. With de-DE, I do see lang=de-DE, but 12.3 and 12,3 are ok If we simply replace type="number" with type="text", we will reintroduce bug 2542. (In reply to Jonathan Druart from comment #6) > If we simply replace type="number" with type="text", we will reintroduce bug > 2542. That could work using the pattern attribute indeed. (In reply to Jonathan Druart from comment #5) > I do not recreate, on /members/maninvoice.pl?borrowernumber=5, I tried with > FF ESR 45.4.0 and Chromium 55.0.2883.75. > With de-DE, I do see lang=de-DE, but 12.3 and 12,3 are ok Hm. That's odd. Might be some change in browser behaviour? We are using ESR at work too. Will retest. I ended up patching it like that: - <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li> + <li><label for="amount">Amount: </label><input type="text" pattern="\d+(\.\d{2})?" name="amount" id="amount" required="required" value="" step="any" min="0" /> Example: 5.00</li> It could be a mix of having a "German" firefox installed and Plack and other settings... we have seen some weird things happening. See bug 18186. Popping this in here so we don't loose it. https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/ |