Can we set number input format?


Tinn Aphopchung

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/


DecSoft

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.



Tinn Aphopchung

Ok,I will try David.


DecSoft

Hello,

Enjoy the new FormatNumber and UnformatNumber actions!



Tinn Aphopchung

wow, thanks.David!


DecSoft

You're welcome!



Tinn Aphopchung

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?)


Samuel Vanneste

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 :

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


DecSoft

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.



Tinn Aphopchung

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).

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


DecSoft

Hello to all,

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:

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



Tinn Aphopchung
Hello to all,

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:

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 :


and set back in event
Blur:

It can use


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


DecSoft

Hello tin,

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



Tinn Aphopchung

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).


DecSoft

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.


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.