How to create custom tooltip for mandatory fields in Alfresco share property page?

316 views Asked by At

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.

1

There are 1 answers

2
Jeff Potts On

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>