On 16/05/2012, at 11:27 PM, Scott Gray wrote:
> On 16/05/2012, at 11:21 PM, Adrian Crum wrote:
>
>> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>>> Adrian Crum schrieb:
>>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>>> What's the point of CommonEmptyHeader?
>>>>>
>>>>> It's definied in CommonUiLabels.xml as:
>>>>>
>>>>> <property key="CommonEmptyHeader">
>>>>> <!-- do not remove this! -->
>>>>> <value xml:lang="en" xml:space="preserve"> </value>
>>>>> </property>
>>>>>
>>>>> It is just a simple space (0x20)
>>>>>
>>>>> It is used ~500 times in forms as a title in a field definition
>>>>>
>>>>> Example:
>>>>>
>>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>> ...
>>>>> <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>>>
>>>>> <hyperlink target="${donePage}" also-hidden="false"
>>>>> description="${uiLabelMap.CommonCancelDone}">
>>>>> <parameter param-name="partyId"/>
>>>>> </hyperlink>
>>>>> </field>
>>>>> </form>
>>>>>
>>>>>
>>>>> This is a button which should have no label, but if the title attribute
>>>>> is empty then the name attribute is used as label.
>>>>>
>>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>>> but exactly same result a using CommonEmptyHeader without the need using
>>>>> CommonEmptyHeader.
>>>>>
>>>>> The real solution is of course not to display a label if the title
>>>>> attribute is empty.
>>>> An empty title attribute is meant to be a shortcut, or a developer's
>>>> convenience - the widgets will use the field name to look up the correct
>>>> label.
>>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>> - IMHO it is bad for re-using labels...)
>>>
>>>> Putting a space in the title attribute is the only way to turn off the
>>>> default behavior.
>>> Ok, so there is nothing against replacing
>>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>>>
>>
>> That is what we would like to do - but it doesn't work. That is what needs
>> to be fixed.
>>
>> -Adrian
>
> Does element.hasAttribute really return false if an attribute exists with an
> empty value? You'd think the javadoc would call that out since it defies
> common sense.
>
> Regards
> Scott
If it does actually return true then we could just change this:
if (UtilValidate.isNotEmpty(this.title)) return title.expandString(context);
to this:
if (this.title != null) return title.expandString(context);