Hi @dmytrove ,
1. Force Primitive Type Handling: First, make sure the value you get from xfa.layout.h() is treated as a pure number and not a complex object.
2. Ensure Proper Timing: Ensure that the layout is fully ready when you execute your script. If the layout is not ready, the xfa.layout.h() value may not be accessible yet.
3. Check for No Conflicts: Sometimes, LiveCycle might not update the height dynamically unless explicitly forced to, so we need to directly manipulate the height in a way that LiveCycle expects.
// Ensure the layout value is accessible and treated as a primitive number
var mainRowHeight = parseFloat(xfa.layout.h(parent.parent.parent, "in"));
// Ensure it's a valid number
if (!isNaN(mainRowHeight)) {
// Force a clean primitive value (important for LiveCycle)
var stableHeight = +mainRowHeight;
// Perform your calculation
var calculatedValue = stableHeight / 2; // Adjust as needed
// Set the height of the element
this.h = calculatedValue + "in";
} else {
// Handle error or fallback if value is invalid
console.log("Error: Invalid main row height");
}
Key Points in This Solution:
- parseFloat ensures that you're working with a numeric value (no hidden strings).
+mainRowHeight forces the value into a primitive number format, which LiveCycle handles more reliably.
- Error Handling (isNaN): Ensures that you're only proceeding if the xfa.layout.h() value is valid.
Direct Height Assignment: By directly assigning the calculated value to this.h, we’re explicitly updating the height.
Timing Considerations:
If this still doesn't work as expected, try the following:
Use Event Handlers: Place the script inside the layout:ready or form:ready event to ensure everything is initialized.
this.layout.ready = function() {
// Place the same script here
};
Regards,
Amit