Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5904

"Value" attribute of hidden form field is overridden by same name value in context

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Trunk
    • 12.04.06, 13.07.02, Trunk
    • framework
    • None

    Description

      e.g.

      <field ...>
      <hyperlink target="..." link-type="hidden-form" >
      <parameter param-name="partyId" value="Company" />
      ...
      </hyperlink>
      </field>

      If there's a "partyId" key in context, then, the value set here will be overridden.

      This problem is caused by commit r1392766 :

      for (Map.Entry<String, String> parameter: parameterMap.entrySet()) {
      if (parameter.getValue() != null)

      Unknown macro: { + String key = parameter.getKey(); + writer.append("<input name=""); - writer.append(parameter.getKey()); + writer.append(key); writer.append("" value=""); - writer.append(parameter.getValue()); + + String valueFromContext = context.containsKey(key) ? + context.get(key).toString() }

      }

      In this commit, it got context value in preceding of "value" attribute. It's not reasonable.

      This defect mentioned above was caused by trying fix the problem introduced by commit 1298454:

      • return this.value.expandString(context);
        + try
        Unknown macro: { + return URLEncoder.encode(this.value.expandString(context), Charset.forName("UTF-8").displayName()); + }

        catch (UnsupportedEncodingException e)

        Unknown macro: { + Debug.logError(e, module); + return this.value.expandString(context); + }

      In this commit, it called URLEncoder.encode to encode parameter value no matter where the value would be used. Actually, if use this value as the "value" attribute of html form field, it should be encoded by HtmlEncoder not URLEncoder.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jleroux Jacques Le Roux
            utcb Leon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment