major
minor
major
minor
minor
#26797
Transaction with user input: invisible properties of the form model cannot be assigned values (initialized)
Background
In a "transaction with user input," the user input (for the form definition—specifying which values the user should be able to enter) is described as a separate model type. During "initialization," this model type is populated with values from the target model (fields are pre-filled).
Now, during “Initialization,” you may want to store additional information in this model type for the form definition—information that should not be displayed to the user or entered by the user: For example, during “Initialization,” certain properties of the target model should be stored in the form object so that they can be used in a constraint on the form model to “validate” subsequent user input or to annotate “suggested values” for it.
Problem
Such attributes, which are not displayed in the form for user input (either because they are not part of the form or are declared as “hidden”), cannot be assigned values in the “initialization” expression:
Caused by: java.lang.IllegalStateException: Attribute 'tl.contract.offer:OfferStateChangeForm#permittedValues' cannot be modified.
at com.top_logic.element.meta.form.overlay.FormObjectOverlay.tUpdate(FormObjectOverlay.java:449)
at com.top_logic.model.search.expr.DynamicSet.eval(DynamicSet.java:92)
at com.top_logic.model.search.expr.GenericMethod.internalEval(GenericMethod.java:107)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.SearchExpression.eval(SearchExpression.java:54)
at com.top_logic.model.search.expr.Block.internalEval(Block.java:43)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.Call.internalEval(Call.java:57)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82)
at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95)
at com.top_logic.model.search.expr.query.DirectQueryExecutor.executeWith(DirectQueryExecutor.java:62)
at com.top_logic.model.search.expr.query.QueryExecutor.execute(QueryExecutor.java:227)
at com.top_logic.model.search.providers.MonomorphicCreateFormBuilderByExpression.fillFormContext(MonomorphicCreateFormBuilderByExpression.java:99)
After initial consultation, this was classified as a bug.
Test
- /com.top_logic.demo/src/test/java/test/com/top_logic/demo/scripted/layout/transaction/TestCustomTransaction.script.xml