#1 2016-04-09 08:47:31

tin
Member
Registered: 2016-03-20
Posts: 161

Can we set number input format?

About number input,Normally It will not format(example 1500 , 1500.01).
Can we set format something like 1,500.01(with comma format)?After we lost focus number inputbox.

something like this
https://github.com/andrepolischuk/typographic-numbers
http://www.numbox.org/

Last edited by tin (2016-04-09 08:52:30)

Offline

#2 2016-04-09 12:34:26

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello,

Currently something like that is not "out of the box" in App Builder. In the meanwhile (because I want to study it and eventually add some new actions in App Builder) you can try with the library you linked or maybe other similar Javascript library.

Offline

#3 2016-04-09 12:41:44

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

Ok,I will try David.

Offline

#4 2016-04-10 18:12:40

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello,

Enjoy the new FormatNumber and UnformatNumber actions!

FormatNumber "123456789" "3" "." "," "[Result]"

// [Result] = 123.456.789,000
UnformatNumber "123.456.789,000" "," "[Result]"

// [Result] = 123456789

Offline

#5 2016-04-10 19:02:04

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

wow, thanks.David!

Offline

#6 2016-04-10 19:23:48

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

You're welcome!

Offline

#7 2016-07-08 11:48:05

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

Ask again David.I don't know how to use formatnumber
I have input number name = income
I want input show 50,000.Not show like normal is 50000.
How to coding with formatnumber?
And How to set that code in which event? (maybe change event?)

Offline

#8 2016-07-08 12:11:04

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: Can we set number input format?

Hi Tin,
Because a formatted number is no more seen like a number, You'd better of using a "standard" Text control and in its Change event, for example :

FormatNumber "[Input2.Value]" "0" "," "" "[Input2.Value]"

Of course, you'd wish filtering the data entered to be sure they are numbers or the comma

Offline

#9 2016-07-08 12:25:37

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello to all,

Certainly Samuel is right and apparently we can't use a Number Input, but a Text Input. Depend on the application may we can take one or other way, for example, maybe we can shown a Number Input for input purposes, but then we can hide it and show a Text Input with the formatted number. I think this depend on the application.

Remember we have the counter part of the "FormatNumber" action, the UnformatNumber action, then we can pick the formatted number from a Text Input and then unformat it in order to be shown in Number Input.

Just post here if you have any further question Tin.

Offline

#10 2016-07-09 11:56:45

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

Thank Samuel and David.Now I use textbox input to show formatnumber and use event focus to focus number input when Edit(I need to use number input,because I want soft keyboard show numric keyboard).

wcgvu8.png

Another question.Can we set softkeyboard in text input show as numeric keyboard?

Offline

#11 2016-07-09 12:54:02

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello to all,

tin wrote:

Another question.Can we set softkeyboard in text input show as numeric keyboard?

I am not try, but, since the input's kind is defined using the "type" attribute, may we can use the "SetAttribute" action in order to establish the input's kind in runtime? For example, just when our Text Input give the user focus, use "SetAttribute" like:

SetAttribute "MyTextInput" "type" "number"

If I am not wrong the softkeyboard is based in such "type" attribute, so maybe the above can do the trick!

Offline

#12 2016-07-10 12:17:19

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

David wrote:

Hello to all,

tin wrote:

Another question.Can we set softkeyboard in text input show as numeric keyboard?

I am not try, but, since the input's kind is defined using the "type" attribute, may we can use the "SetAttribute" action in order to establish the input's kind in runtime? For example, just when our Text Input give the user focus, use "SetAttribute" like:

SetAttribute "MyTextInput" "type" "number"

If I am not wrong the softkeyboard is based in such "type" attribute, so maybe the above can do the trick!

After testing this code.It can use in text inputbox.It can use in event
Focus :

SetAttribute "Input1" "type" "number"

and set back in event
Blur:

SetAttribute "Input1" "type" "text"
FormatNumber "[Input1.Value]" "0" "," "." "[Input1.Value]"

It can use

FormatNumber "[Input1.Value]" "0" "," "." "[Input1.Value]"

in change event.But cannot run normally in android app(no problem in browser).

Offline

#13 2016-07-10 12:43:37

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello tin,

Please, can you describe what is your expected behaviour and what you get in Android?

Offline

#14 2016-07-11 10:55:58

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Can we set number input format?

I expected to number input that will change format when user typing.something like when you typing in calculator app that come with window 10.It will show comma immediately after you typing 5000(show 5,000).

Offline

#15 2016-07-11 11:01:21

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Can we set number input format?

Hello tin,

If the "Focus" / "Blur" events trick works, that is, if we can change the input type as expected for the softkeyboard, then may we need to take care about the "Change" event. Maybe, when we enter in the "Focus" event, can set certain "flag variable" to "True", and then, in the "Blur" event, set that variable to "False".

Why to do this? The idea (I don't know if they can work, but we can try it before try any other possible approach) is to format the number in the "Change" event ONLY if the input doesn't have the focus. In the "Change" event we can look for the "flag variable", and, only apply the format if such variable is "False", that is, the input has no the focus.

Hope you can understand what I means tin.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.