398
Views
12
Comments
Solved
[Input Mask Reactive] Currency input mask - Reset value to 0
input-mask-reactive
Reactive icon
Forge asset by Steven Decock

Hi,

I have one question about this scenario:

 I have an input field that using currency input mask for ', ' separator and decimal place. It works well but there is an issue if i need to reset the value of the input field to 0 after validation check negative number. I want to make it back to 0 after validate the negative number but  the value displayed on input field does not reset and remain the same . The input field use onChange event to trigger validation for negative number.

I hope there is a solution for this.

Thank you




2022-10-17 06-51-09
Shweta Gedam
Solution

Hi Aqil,

I went through your oml and found solution. You just need to set your Currency variable data type to text instead of decimal and it works same as you were using it for decimal variable and also reset variable to 0 if entered number is negative.

I have attached working OML herewith.

and here is the reference link of the demo:

https://shweta-gedam.outsystemscloud.com/InputMaskSample/InputTest?_ts=637442639333746161

Hope it works now, Thanks and Happy Coding!!

InputMaskSample.oml
2020-06-04 15-38-19
Samiksha Manekar

Hi Aqil,

You have to only assign variable(currency)=0.


Hope this helps.

thanks,

Samiksha

2023-01-27 13-47-30
Ahmad Aqil

Sorry my bad, actually im using another forge which is InputMaskReact > MaskCurrency and already put assign node to set 0..but still not working. 

2020-06-04 15-38-19
Samiksha Manekar

may be it is due to variable data type. if variable data type is decimal then assign 0.0, if text then "", and integer then 0.

please try and let me know.

UserImage.jpg
Syakir

Hi sorry to bother, but for my case, the variable can't be change to data type = text due to the variable is coming from aggregate (database).. so any solution due to this?

2022-10-17 06-51-09
Shweta Gedam

HI Aqil,

Are you using any prefix like '$' for currency Input and also what is the data type of your input field in Input type properties and variable?

2023-01-27 13-47-30
Ahmad Aqil

Hi Shweta, not using any prefix for now and data type is Number for the input field. I found out that if input  value is set to other value than 0 it will display the new value. Maybe it is because 0 is a default value and by default the input field will be empty?

2022-10-17 06-51-09
Shweta Gedam

Could you please share OML for the same?

2023-01-27 13-47-30
Ahmad Aqil

Please find the attached OML file for your review

Thanks

InputMaskSample.oml
2022-10-17 06-51-09
Shweta Gedam
Solution

Hi Aqil,

I went through your oml and found solution. You just need to set your Currency variable data type to text instead of decimal and it works same as you were using it for decimal variable and also reset variable to 0 if entered number is negative.

I have attached working OML herewith.

and here is the reference link of the demo:

https://shweta-gedam.outsystemscloud.com/InputMaskSample/InputTest?_ts=637442639333746161

Hope it works now, Thanks and Happy Coding!!

InputMaskSample.oml
2023-01-27 13-47-30
Ahmad Aqil
2022-10-17 06-51-09
Shweta Gedam
UserImage.jpg
Nur Asy Syakirin Zubir

Hi I am sorry to reply at old post, but if i changed the variable type from number to text, it will allow user to key in alphanumeric, how to prevent that?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.