This is an automated email from the ASF dual-hosted git repository.
jacopoc pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new fc69e4ca8c Fixed: Form fields are not properly populated with values
from the context due to a regression introduced by commit 69697d1 (OFBiz-13331)
(#936)
fc69e4ca8c is described below
commit fc69e4ca8c76ee484a98225dfc0a2ba11d063c89
Author: Anahita Goljahani <[email protected]>
AuthorDate: Wed Jan 14 10:30:53 2026 +0100
Fixed: Form fields are not properly populated with values from the context
due to a regression introduced by commit 69697d1 (OFBiz-13331) (#936)
This commit restores the condition that determines whether request or
context parameters are used to the behavior prior to commit 69697d1. It
also implements the new useRequestParameters.<form_name> context
attribute for ModelGrid forms, which was introduced in that commit.
---
.../main/java/org/apache/ofbiz/widget/model/ModelFormField.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
index 28ca63581d..334c09b04d 100644
---
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
+++
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
@@ -289,8 +289,10 @@ public final class ModelFormField {
}
public String getEntry(Map<String, ? extends Object> context, String
defaultValue) {
- Boolean useRequestParameters = (Boolean)
context.getOrDefault("useRequestParameters", UtilGenerics.cast(Boolean.TRUE))
- && (Boolean) context.getOrDefault("useRequestParameters." +
modelForm.getName(), UtilGenerics.cast(Boolean.TRUE));
+ Boolean isError = (Boolean) context.get("isError");
+ Boolean useRequestParametersGlobal = (Boolean)
context.get("useRequestParameters");
+ Boolean useRequestParametersSpecific = (Boolean)
context.get("useRequestParameters." + modelForm.getName());
+ Boolean useRequestParameters = useRequestParametersSpecific != null ?
useRequestParametersSpecific : useRequestParametersGlobal;
Locale locale = (Locale) context.get("locale");
if (locale == null) {
@@ -305,7 +307,8 @@ public final class ModelFormField {
String returnValue;
- if (useRequestParameters) {
+ if ((Boolean.TRUE.equals(isError) &&
!Boolean.FALSE.equals(useRequestParameters))
+ || (Boolean.TRUE.equals(useRequestParameters))) {
Map<String, Object> parameters =
UtilGenerics.checkMap(context.get("parameters"), String.class, Object.class);
String parameterName = this.getParameterName(context);
if (parameters != null && parameters.get(parameterName) != null) {