Oracle APEX's Universal Theme provides a modern and clean user experience through features like floating (above) labels for page items.
These floating labels work seamlessly when users manually enter data, automatically moving the label above the field on focus or input.
However, a common UI issue appears when page item values are set Dynamically the label and the value overlap, resulting in a broken and confusing user interface.
once the user focuses the affected item even once, the label immediately corrects itself and displays properly.
When an issue is reported, several values are populated based on a single user input, causing the UI to appear misaligned and confusing for the end user.
Here, I'll share a few tips to fix this issue.
For example, employee details are populated based on the Employee name.
In this case, the first True Action is used to set the values, and in the second True Action, paste the following code
setTimeout(function () {
$("#P29_EMAIL,#P29_ADDRESS,#P29_PHONE,#P29_DEPT,#P29_DOB_input").each(function () { // Page item names / P29_DOB_input = date picker static ID
if ($(this).val()) { // Add the CSS class only if the value is set
$(this).closest(".apex-item-wrapper").addClass("js-show-label");
}
});
}, 1000); // 1-second delay because Popup LOV takes time to render
Instead of calling the above code in a True Action, you can also place similar logic in a Page Load Dynamic Action
setTimeout(function () {
$("#P29_EMAIL,#P29_ADDRESS,#P29_PHONE,#P29_DEPT,#P29_DOB").each(function () {
$(this).closest(".apex-item-wrapper").addClass("js-show-label");
});
}, 1000);
This code runs when the page loads and applies the CSS class without any condition
Comments
Post a Comment