Support Article
Currency Control when editing focus jumps to front of the value
SA-57946
Summary
When editing the currency control, the cursor focus shifts to the front of the value.
The currency field (with currency control) is configured to display as an editable field which uses Read Only formatting (that is, 12.00 EEK). On clicking in the field, the focus moves to the front of the value.
Error Messages
Not Applicable
Steps to Reproduce
- Create a section with a property which stores currency (use the Currency property).
- Configure the Read Only display such that, 12 displays as 12.00 USD.
- Use this configuration for editable fields (out-of-the-box functionality).
- Click the fields at runtime to set the cursor focus in the required position (for example, 1|2.00). After the click, the cursor shifts to the front of the value.
Root Cause
A defect in Pegasystems’ code or rules.
Resolution
Perform the following local-change at the global level.
Include the below script in the UserWorkForm.
<script>
if(pega.ui && pega.ui.d) {
pega.ui.d.focuslistnerattachcust = function() {
$("input[data-formatting]").focus(function(e){
var target = e.target;
var valLength = target.value.length;
var myNav = window.navigator.userAgent;
console.log("myNav:-"+myNav);
var isIE= myNav.indexOf("MSIE ");
if (isIE > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
target.setSelectionRange(valLength,valLength);
}
});
};
pega.ui.d.attachOnload(pega.ui.d.focuslistnerattachcust, true);
}
</script>
Published December 29, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.