Page MenuHomePhabricator

Numeric fields with commas causing errors
Closed, ResolvedPublicBUG REPORT

Description

Testing simple numeric field entries yields these results:

  1. 1234567 - no error
  2. 123,456 - no error
  3. 1,234,567 = "must be a valid number"

Ran test on both SemForms 2.6 and 2.7 -- same error occurs.
Running SMW 1.8.0.5 on mw 1.21


Version: unspecified
Severity: normal

Details

Reference
bz67339
Related Changes in Gerrit:

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:39 AM
bzimport set Reference to bz67339.

https://www.mediawiki.org/wiki/Extension:Page_Forms/Input_types

Is it text field? Number field is not listed in PageForms ( successor of SMW ).

It would just be a text field containing a number, yes.

Can anyone give me the PageForm syntax i.e. in terms of {{{field|num|input type...}}}

Just something like "{{{field|num}}}" should work.

I am reproducing this issue currently in SpecialPages:CreateForm.

Screen Shot 2018-01-24 at 11.30.45 AM.png (256×152 px, 18 KB)

Screen Shot 2018-01-24 at 11.31.34 AM.png (668×682 px, 64 KB)

There is no error showing in there.

@Himanshuc3: If you try to reproduce issues you need to explain how you try to reproduce issues, otherwise we all just guess which takes time.
In this case, which exact number(s) you entered to test the behavior.

Q. Is generating form from Special:CreateForm the right way to reproduce the issue?
If not what is the correct way? @Aklapper
Right now every input is validating/passing i.e. not showing any error.

@Himanshuc3 - I probably should have specified this before, but to make the field numeric, you need to associate it in the template with a property of type "Number" (if you're using SMW), or associate it in the template with a Cargo field of type "Integer" (if you're using Cargo).

I can't reproduce this issue. I did following way to reproduce it.
Created a template and assigned it a table which consists a field of type integers using Cargo

View table: Int_temp - wiki - Mozilla Firefox_003.png (745×574 px, 82 KB)

and then created a page through a form and gave the above value it produced correctly even integer is taken with multiple commas as shown.

@Rammanojpotla - cool! Maybe this problem got fixed at some point.

If you put in a text string in that field, like "ABC", does it get rejected?

Sorry for above message. I don't know what happened last time but this time if I make change to the same page with multiple commas it is returning me an error and even with string format mentioned above. It is not giving error with one comma but with multiple it raising error there is also an issue with my current page I can't what happened last time
this is the screenshot of table items and their values

View table: Int_temp - wiki - Mozilla Firefox_005.png (745×574 px, 83 KB)

and when I entered the "hello from" page provided there I see the following value
Hello form - wiki - Mozilla Firefox_006.png (745×574 px, 80 KB)

The following is screenshot of occurrence of above error
Edit Input temp: hello form - wiki - Mozilla Firefox_007.png (745×574 px, 48 KB)

I think the bug is reproduced in above screenshot due to some mismatching with tables local branches I think first two screenshots created was confusing so I kept above message

made a small change looked in the following format

Create Input temp: tempate 1 - wiki - Mozilla Firefox_008.png (745×518 px, 38 KB)

and the page created in following format
Tempate 1 - wiki - Mozilla Firefox_009.png (745×518 px, 79 KB)

can I upload a patch to it?

Aklapper triaged this task as Low priority.Feb 4 2022, 8:07 PM
Aklapper changed the subtype of this task from "Task" to "Bug Report".

Change 913932 had a related patch set uploaded (by Techwizzie; author: Techwizzie):

[mediawiki/extensions/PageForms@master] Fix number validation

https://gerrit.wikimedia.org/r/913932

Change 913932 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Fix number validation

https://gerrit.wikimedia.org/r/913932

Yaron_Koren claimed this task.

I believe this is fixed, at last!