Issue Details (XML | Word | Printable)

Key: WW-1121
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Rainer Hermanns
Reporter: Tobias Järlund
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

Freemarker error if "name" parameter is missing

Created: 25/Jan/06 05:02 AM   Updated: 27/Jan/06 12:02 PM
Component/s: Views
Affects Version/s: 2.2
Fix Version/s: 2.2.1

Flags: Patch


 Description  « Hide
Name is not a required parameter for the form tags, but if it is missing both the xhtml and the css_xhtml theme throw an error.


The problem is in the line that checks for field errors.
This patch takes care of that:

Index: src/java/template/css_xhtml/controlheader.ftl
===================================================================
RCS file: /cvs/webwork/src/java/template/css_xhtml/controlheader.ftl,v
retrieving revision 1.4
diff -u -r1.4 controlheader.ftl
--- src/java/template/css_xhtml/controlheader.ftl 7 Jan 2006 00:03:57 -0000 1.4
+++ src/java/template/css_xhtml/controlheader.ftl 25 Jan 2006 10:43:02 -0000
@@ -2,7 +2,7 @@
  Only show message if errors are available.
  This will be done if ActionSupport is used.
 -->
-<#assign hasFieldErrors = fieldErrors?exists && fieldErrors[parameters.name]?exists/>
+<#assign hasFieldErrors = parameters.name?exists && fieldErrors?exists && fieldErrors[parameters.name]?exists/>
 <div <#rt/><#if parameters.id?exists>id="wwgrp_${parameters.id}"<#rt/></#if> class="wwgrp">
 
 <#if hasFieldErrors>
Index: src/java/template/xhtml/controlheader-core.ftl
===================================================================
RCS file: /cvs/webwork/src/java/template/xhtml/controlheader-core.ftl,v
retrieving revision 1.1
diff -u -r1.1 controlheader-core.ftl
--- src/java/template/xhtml/controlheader-core.ftl 22 Dec 2005 06:17:16 -0000 1.1
+++ src/java/template/xhtml/controlheader-core.ftl 25 Jan 2006 10:41:58 -0000
@@ -2,7 +2,7 @@
  Only show message if errors are available.
  This will be done if ActionSupport is used.
 -->
-<#assign hasFieldErrors = fieldErrors?exists && fieldErrors[parameters.name]?exists/>
+<#assign hasFieldErrors = parameters.name?exists && fieldErrors?exists && fieldErrors[parameters.name]?exists/>
 <#if hasFieldErrors>
 <#list fieldErrors[parameters.name] as error>
 <tr errorFor="${parameters.id}">


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Rainer Hermanns added a comment - 27/Jan/06 12:02 PM
patch applied, thanks