0

I have to create some custom tooltip on Alfresco property page. I tried following code with "Description" attribute, but its not working for mandatory fields because for mandatory fields, default tooltip is "The value can not be empty"

<field id="abc:xyz" set="fieldset" description="Some Description" >
            <control template="/com/xyz/controls/custom-list.ftl" />
            </field>

How can I override that default message for mandatory fields and give my custom message on tooltip.

Thanks in Advance.

Deepak Talape
  • 997
  • 1
  • 9
  • 35

1 Answers1

3

You should be able to use description or description-id if you want to use an i18n property instead of putting the description in the form config.

You can also use help and help-id, but those don't make tooltips. Using one of those creates a question mark next to the property that hides/shows help text below the field control.

It looks like you are using a custom control. I'm not sure what you've done there, but I recently did a custom multi select control based on the out-of-the-box selectmany.ftl and I believe I had to tweak it to have a tooltip per entry by putting a title attribute on every option element.

Something like:

        <#list field.control.params.options?split(optionSeparator) as nameValue>
            <#if nameValue?index_of(labelSeparator) == -1>
                <option value="${nameValue?html}"<#if isSelected(nameValue)> selected="selected"</#if>>${nameValue?html}</option>
            <#else>
                <#assign choice=nameValue?split(labelSeparator)>
                <#assign choiceTitle="{form.field.description." + choice[0] + "}">
                <option value="${choice[0]?html}" title="${msgValue(choiceTitle)?html}" <#if isSelected(choice[0])> selected="selected"</#if>>${msgValue(choice[1])?html}</option>
            </#if>
        </#list>
Jeff Potts
  • 10,468
  • 17
  • 40
  • This is working for custom control, but I also have some mandatory fields which are not custom control and they are a drop down list which are coming from constraints. Is there any way to change for that as well? – Deepak Talape Nov 19 '18 at 19:21
  • You can use the exact same approach. The example I show here is for a property that pulls its dropdown values from constraints. – Jeff Potts Nov 19 '18 at 23:21