From 10.04 it is possible to add tooltip help to form labels for forms created using ofbiz xml definitions. The tooltips are activated by hovering over the field label, for example:
These tooltips messages are simple to add, the steps are:
1) add a resource to the entity
2) create the resource file (if necessary)
3) add the message text
4) add entity-name / default-entity name to form definition (if necessary)
1) Add a default-resource-name attribute to the entity definition in the entitymodel.xml file:
<entity entity-name="Example" package-name="org.ofbiz.example.example" title="Example Entity" default-resource-name="ExampleEntityLabels" >
Note that the entitymodel element has a sub element <default-resource-name>, but this does NOT appear to be working.
2) Create the resource file (if necessary)
The default-resource-name created in step 1 above points to a file in the component's config folder. For the example component with a default-resource-name of ExampleEntityLabels, the file will be:
framework/example/config/ExampleEntityLabels.xml
3) add the message text
In the resource file created in step 2 above, add the message text for the field. The key name format is:
FieldDescription.<entityname>.<fieldname>
For the exampleTypeId field in the example entity, the key would be FieldDescription.Example.exampleTypeId. Enter your help text using the value element with the appropriate xml:lang setting.
<property key="FieldDescription.Example.exampleTypeId"> <value xml:lang="en">The type of Example.</value> <value xml:lang="fr">Le type de l'exemple.</value> </property>
It is recommended that the value text is no longer than 80 characters.
4) add entity-name / default-entity-name to form definition (if necessary)
In some forms, it is necessary to give ofbiz some hints which entity a field description comes from. This will become apparent if the tooltip doesn't display for a label.
It is possible to declare the default-entity-name for a form, e.g.
<form name="EditExample" type="single" target="updateExample" title="" default-map-name="example" default-entity-name="Example">
It is possible to also declare the entity-name at the field level, e.g.
<field use-when="example!=null" name="exampleId" title="${uiLabelMap.ExampleExampleId}" tooltip="${uiLabelMap.CommonNotModifRecreat}" entity-name="Example"><display/></field>