You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Michael Brohl (JIRA)" <ji...@apache.org> on 2015/05/26 23:32:18 UTC

[jira] [Comment Edited] (OFBIZ-6312) Catalog Manager's EditProduct screen HTML should place a limit on the size of text that can be entered in the Product Description box

    [ https://issues.apache.org/jira/browse/OFBIZ-6312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14559904#comment-14559904 ] 

Michael Brohl edited comment on OFBIZ-6312 at 5/26/15 9:31 PM:
---------------------------------------------------------------

Forrest,

thanks for your patch. It has to be applied (partly) manually, because the macro libraries have changed.

I have some questions regarding your changes in ModelFormField.java:

{code}
            Integer maxlength = null;
            String maxlengthStr = element.getAttribute("maxlength");
            if (!maxlengthStr.isEmpty()) {
                try {
                    maxlength = Integer.valueOf(maxlengthStr);
                } catch (Exception e) {
                    if (UtilValidate.isNotEmpty(maxlengthStr)) {
                        Debug.logError("Could not parse the size value of the text element: [" + maxlengthStr
                                + "], setting to default of " + maxlength, module);
                    }
                }
            }
            this.maxlength = maxlength;
{code}

1. maxlength is initialized with null, but referred to as default in the error log. I think it should be initialized with a default value, shouldn't it?
2. the 2nd check if maxlengthStr is empty is unnecessary, do you agree?
3. I would catch a NumberFormatException here, that's the exception thrown by Integer.valueOf(String value), ok?

Please confirm the findings or revoke them, maybe I'm missing something.

Do you already have a solution for the default value? Then a new patch would be fine.

Thanks and regards,

Michael



was (Author: mbrohl):
Rae,

thanks for your patch. It has to be applied (partly) manually, because the macro libraries have changed.

I have some questions regarding your changes in ModelFormField.java:

{code}
            Integer maxlength = null;
            String maxlengthStr = element.getAttribute("maxlength");
            if (!maxlengthStr.isEmpty()) {
                try {
                    maxlength = Integer.valueOf(maxlengthStr);
                } catch (Exception e) {
                    if (UtilValidate.isNotEmpty(maxlengthStr)) {
                        Debug.logError("Could not parse the size value of the text element: [" + maxlengthStr
                                + "], setting to default of " + maxlength, module);
                    }
                }
            }
            this.maxlength = maxlength;
{code}

1. maxlength is initialized with null, but referred to as default in the error log. I think it should be initialized with a default value, shouldn't it?
2. the 2nd check if maxlengthStr is empty is unnecessary, do you agree?
3. I would catch a NumberFormatException here, that's the exception thrown by Integer.valueOf(String value), ok?

Please confirm the findings or revoke them, maybe I'm missing something.

Do you already have a solution for the default value? Then a new patch would be fine.

Thanks and regards,

Michael


> Catalog Manager's EditProduct screen HTML should place a limit on the size of text that can be entered in the Product Description box
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-6312
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6312
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: product
>    Affects Versions: Release Branch 14.12, Trunk, 12.04.05, 13.07.01
>            Reporter: Forrest Rae
>            Assignee: Michael Brohl
>             Fix For: Trunk
>
>         Attachments: OFBIZ-6312.patch
>
>
> Catalog Manager's EditProduct and EditProductDup screens HTML should place a limit on the size of text that can be entered in the Product Description box.  When more than 255 characters are entered an error is displayed.  There is no easy way of knowing when you've hit the 255 character max without the HTML limiting it.
> The patch I'm including changes the TextArea to include the maxlength argument.  This should be useful in other areas of the system.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)