Prerequisite constraints defined in a data dictionary are broken when the page (with an input that references the attribute) is reloaded, either by hitting the browser reload button or navigating away and then returning to the page. Not sure if it's relevant or not, but the page in question here is part of a maintenance view.
Here's the specific scenario. In this DD def ...
... if I modify the CourseInfo.pilotCourse bean like ...
<bean id="CourseInfo.pilotCourse" parent="CourseInfo.pilotCourse-parent"/>
<bean id="CourseInfo.pilotCourse-parent" abstract="true" parent="CourseInfo.pilotCourse-generated">
<bean parent="PrerequisiteConstraint" p:propertyName="courseInfo.endTerm">
<property name="messageKey" value="Some key"/>
It works as expected the first time the page is loaded, but if the page is reloaded a JS error is generated in krad.utility.js#getAttributeId(elementId). I believe this is because PrerequisiteConstraint#getPropertyAdjustedBindingPath(String propertyPath) prepends the bindingPath to propertyPath on page reload. So, the binding property name gets set to ...
.... then ...
This isn't a problem when the same constraints are configured directly in the input definition.
- Add a prerequisite constraint to the DD and reference the attribute from an input field (perhaps on a maintenace doc)
- Load the page
- Reload the page either with the refresh button or navigating away from the page and back
- Expected: The constraint is functional
- Actual: As JS error is thrown and the page is initialized propertly