Posted: 20 Aug 2019 14:07 EDT Last activity: 20 Aug 2019 15:38 EDT
Approach to format UI on screen
I have requirement to format a height field entered as "XXX" (e.g. 511) to 5 ft 11 in. I started to use Edit Input to reformat it. However the value used from clipboard should be 511 and not above format (just for presentation).
Is Edit Input the right way to achieve above?
***Edited by Moderator Marissa to update platform capability tags****
Yes, custom controls are generally not recommended, but if you have such a requirement and there is no alternative OOTB approach or feature, custom code/controls is often the only way to go.
Of course, not unless there is wiggle room with the requirement itself.
Also related, whenever you consider doing any sort of data manipulation like this it is going to be important to test edge cases and other error handling. I assume this is for a human height, so "511" would never mean 51 ft 1 inch, but it could... And what if you had a more realistic input with the same idea.
For example for some regions it is common to list out your height in cm. So someone doing a conversion to inches may do something like "60"
Now is this 6 ft, 0 inches? Is this 60 inches, which is 5 ft? Or is this 60 ft, no inches? There can be a lot of ambiguity with having a requirement like this which allows for error prone user input.