Howdy folks,
When using a TextItem whose type is 'float' and a numeric mask is specified, the data entry is not behaving as would normally be expected.
The code above renders a field with the following mask: ___,___.00
When the control receives focus, the cursor is all the way to the left, and entering numbers results in the values being entered from left to right. This requires a user to manually move the cursor to the desired starting digit in order to enter the value. Further, they must manually enter the commas.
Expected behavior: When the field acquires focus, the cursor should be on the right. Data entry should populate the field from the right, such that the field's display value is as follows when entering in the numbers 1,2,3,4 and 5.
___,__1.00
___,_12.00
___,123.00
__1,234.00
_12,345.00
Some systems also only insert digits to the left of the decimal, and then only put digits to the right if the decimal character is typed. So, 1,2,3, ., 4, 5 would result in:
___,__1.00
___,_12.00
___,123.00
___,123.00
___,123.40
___,123.45
A workaround that might be suggested here would be to only accept numeric input, then formatting the value on the blur event. The problem with this approach is that it only supports whole numbers, not numbers with decimal values. The mask types for numerics only allow digits, "plus" and "minus". The decimal point is not supported. Putting a literal decimal point in the mask requires that the use navigate the cursor past the point mask character.
Before I head down the route of having to write my own mask type, is there something that I am overlooking?
Searching through the forums, I see that this is something that has caused other people difficulties, especially when it comes to currency masks. Some helpful guidance would be appreciated.
Thanks in advance,
Sol
When using a TextItem whose type is 'float' and a numeric mask is specified, the data entry is not behaving as would normally be expected.
Code:
{ name: 'pAmount', type: 'float', title:'Amount', useMask:true, mask:'000,000.00', visible:false, required:false, textAlign: 'right'}
When the control receives focus, the cursor is all the way to the left, and entering numbers results in the values being entered from left to right. This requires a user to manually move the cursor to the desired starting digit in order to enter the value. Further, they must manually enter the commas.
Expected behavior: When the field acquires focus, the cursor should be on the right. Data entry should populate the field from the right, such that the field's display value is as follows when entering in the numbers 1,2,3,4 and 5.
___,__1.00
___,_12.00
___,123.00
__1,234.00
_12,345.00
Some systems also only insert digits to the left of the decimal, and then only put digits to the right if the decimal character is typed. So, 1,2,3, ., 4, 5 would result in:
___,__1.00
___,_12.00
___,123.00
___,123.00
___,123.40
___,123.45
A workaround that might be suggested here would be to only accept numeric input, then formatting the value on the blur event. The problem with this approach is that it only supports whole numbers, not numbers with decimal values. The mask types for numerics only allow digits, "plus" and "minus". The decimal point is not supported. Putting a literal decimal point in the mask requires that the use navigate the cursor past the point mask character.
Before I head down the route of having to write my own mask type, is there something that I am overlooking?
Searching through the forums, I see that this is something that has caused other people difficulties, especially when it comes to currency masks. Some helpful guidance would be appreciated.
Thanks in advance,
Sol
Comment