Bug in fieldlookup.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug in fieldlookup.js

SkipDever
Created a jira OFBIZ-5255.

I did not create a patch for this because I was not sure what the authors
intent was.

However, the bug is in fieldlookup.js line 221:

if (ajaxUrl != "" && showDescription != "")

If you pass showDescription="false" as an argument to the macro
<@htmlTemplate.lookupfield , you will currently disable autocompletion which
I am sure is not the intent given the description in the comments of
htmlformMacroLibrary.ftl.

I suspect the author may have wanted && showDescription != undefined or
maybe an empty Sting test like this:

function isEmptyStr(str)
{
        return (str===undefined  || !str || 0 === str.length);
}

Because showDescription is used as a boolean later on in the block, I
changed my code to test for a boolean like

if (ajaxUrl != "" && (typeof showDescription === "boolean"))

If the code is changed as above, everything works.

skip