• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Beware! Web app rounds value in number field in admin

Community Beginner ,
May 01, 2012 May 01, 2012

Copy link to clipboard

Copied

There is a bug with the web apps number field in the admin area.  It is rounding number fields when it displays the values on the edit screen in the admin.  If you put in a number "1.52", save, exit the item and go back in, it shows "2".  If you don't see this and resave, your web app item now has "2" instead of "1.52".   "2" displays on the public site since it is the new value.

There was an issue with a site I developed where a large number value kept mysteriously changing.  I could've sworn it was right!  But my client would go in to edit the web app item descriptions, these numbers were rounding and getting saved as the new value.

I just discovered why this was occurring while working on a new site that is heavily dependent on number fields.

1.52  rounds to 2

359.5 rounds to 360

Even very large numbers round....  4882124  is rounding to 4882120

Just a warning to everyone to watch out for this bug if you are editing web apps in the admin until they get it patched.   As a workaround, use a text/string field and put in your own Javascript checking for number format for the public site.

It's been a bug for a long time!  I reported this to support and it has been escalated (OBNW4333860).

Chris


TOPICS
Web apps

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2012 May 01, 2012

Copy link to clipboard

Copied

Hey Chris, this is quite a commonly known thing, I think Mario even ported over the note as one of the many great documents here or one of the FAQ's already

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 01, 2012 May 01, 2012

Copy link to clipboard

Copied

This is a bug with the Web App item editing, not an FAQ and needs fixed...  It is wreaking havoc on my sites.  If a number field has a member ID, someone logs into the admin to edit the web app item, the number (member ID) is being rounded and re-saved and people are using the wrong member IDs when they search the profiles on the site.

I have gone back to export the web app items, delete the number fields, re-add them as text/string and re-import the items so the numbers are treated as text and will not be rounded.

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Hi Chris,

I will ask the dev team to remove that field type from web apps and web forms. It is not very clear that it can only store integers and people are running into these issues. Please use Text(string) for everything.

Cheers,

mario

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Thanks for looking at this...  They can keep it, but re-label it to "Integer" and create another one for "Decimal".

It is rounding large integers, too.   Ex:  4882124 rounds to 4882120

I'm starting to change these fields to Text(string) now.  By using Text (string), it doesn't produce the appropriate javascript code on the public side.  As the developer I can easily put in javascript code.  For a client/business owner, the fields will never prevent invalid characters...

Just more stuff to add on to Web App improvements whenever you get to it.

Chris


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Why do you need a Decimal one added? Like Mario said the text one hold text and numerical values. You only need that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

Liam, I already explained it above...  If the number type is selected it provides the javascript in the add/edit forms to check numbers and prevents other characters from getting submitted.  Easy to fix for a developer.  Not easy to fix for a typical client user.

The number field type prevents other characters from getting submitted from the web app admin side, too.  However, it allows you to submit decimal numbers from the admin side and the public add/edit form.  This would lead anyone to believe that it will preserve the data.

There's a purpose for every field.  Just like choosing a date field to guarantee only dates are submitted in the correct format.  Why not decimal?  There should be a field that allows for decimal numbers that doesn't round and provides the appropriate validation.  Even if they just store it as text in the database, but still provide the appropriate validation scripts.  That would solve it.

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

JavaScript validation is not a good reason. Server side validation would be a good reason. So, when you submit a form it would check what's in the field and return the user back to the same page with the error message. And you could define the size, number of decimal places or you could create HTML5 field types, such as number type and so on.

These are probably all of the things coming to BC, but for now I'd rather see that field removed

Cheers,

mario

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 02, 2012 May 02, 2012

Copy link to clipboard

Copied

LATEST

Mario,

I'd expect a better answer.  BC was built depending heavily on Javascript validation and BC still generates a ton of JavaScript code for form validations.... so JavaScript validation is all your forms have.  User experience is better for prevention before submission plus I have no access to server-side validation rules nor does it provide any space to specify these rules.

I can't add Javascript to your admin edit screen or add HTML5 stuff to your admin edit screen.  My clients will never learn how to add HTML5 field types or modify what BC generates.  So it leaves a broken feature... Issues like these just need short-term fixes with the hope of long-term solution.  Needless to say BC has web ads promoting web forms without coding (false advertisement?).  Forms require a ton of coding.

Looking forward to big improvements to Web apps and Web forms in the future!  Hopefully the near future.

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines