Dynamically updating XFDL options at runtime from within an XForms table does not invoke a table refresh

Technote (FAQ)

Question

An XForms table dynamically updates some XFDL presentation attributes while you are filling the form. When the dynamic change occurs, all XForms bindings or references are updated, but the XFDL presentation option changes are not reflected in the table until the table is refreshed.

How do you force your change to reflect in both XForms and XFDL without manually forcing a table refresh (such as by add/remove a row)?

Cause

XFDL attributes that invoke either localized or page level refreshes do not refresh when they are located within a table.

The reason for this is that tables use a deferred update or refresh system to improve form performance. Therefore, XForms tables do not fully obey the default behaviors as specified by Supported XFDL Options table in the following link:

You will find that some XFDL options do not invoke a refresh instead wait for a table refresh (for example, add/remove a row) to occur.

Answer

The alteration of an XFDL item does take effect in the back-end, but the presentation of the widget in the form does not update to reflect the change until the table is forced to redraw itself by adding or deleting a row (or any other method that invokes a table or page refresh, such as using the 'keypress' or 'focused' attribute to watch a change).

To ensure a localized refresh occurs within the table that reflects your dynamic update, watch the event that is invoking the change (toggle) in the option and then push/pull (set/get) the update accordingly, instead of pushing/pulling (set/get) your change to the XFDL option directly without using a toggle to watch for the change.

Note: The Webform Server by default does not register keypress or focus events. If you want to enable it to do so you can change the focusNotificationItems setting in the translator.properties. It is not recommended that you enable this setting as it will affect your systems overall performance.

This is best explained through the following example.

NOTE: This Technote requires an intermediate understanding of form design. It is not intended for novice users.

Prerequisites for Example: - Have an understanding of XFDL keypress event. - Understand the use of xforms.getPosInSet() function - Understand the use of set() and get() with xforms model. - Have a good understanding of Xforms data model and repeat structures (tables).

Example Details:
- Table fields are watching for the keypress event on the letter 'b'.

Table A depicts the deferred table refresh where the corresponding label text will change to either 'bold' or 'plain' once the focus has moved away from the field and only change the font effect to 'bold' or 'plain' once the table has been manually refreshed.

Table B on the other hand, properly reflects the toggling of the font effect and label value as the letter 'b' or 'p' is typed into the field.

NOTE: We have found that in Lotus Forms Viewer version 3.5.1, implementing the above technique has a side-effect of refreshing the whole table that it is bound to. This is a trade-off that one must be aware of and should be considered when moving forwards with this workaround.