[SOLVED] Multiple Occurrences with HTML-Widget inside

Author: lorenzen@ahp-gmbh.de (lorenzen)

Hallo there, we use the HTML-Widget to load generated html-content. This HTML-content has to use some Extended-Trigger functions, so we have to use $fieldhandle(HTML)->$widgetoperation("loadHTML",lv_htm) to show the content. And here comes is a problem. If there are more than one Occurrence in an Entity, that contains an HTML-Widget, Content dosen't updated, by change the selected occurrence. Change to "UseFieldValue=T" is not posible. I also tried with a "show" on "Occurrence get Focus - Trigger". No changes. We use UnifAce 9.7.03 to Test. Regards Lars Lorenzen


  1. Hi, Try to use field "Form container" in each occ. Create a component with html widget, and make an instance for each occ. He should work ... i think .... Gilles.

    Author: Gilles (gls.tools@free.fr)
  2. Hi Lars, Gilles is right, embedding the HTML-widget into a contained form and use a form container in the mult-occ. entity should fix the described issue. You can find more info about this behavior in the documentation: > Uniface Library > Uniface Reference > Proc: Functions > $fieldhandle > $widgetoperation

    The $fieldhandle function returns the handle of the widget that is bound, at that moment, to the specified field of the current occurrence. The function $widgetoperation works only on the widget, even if the widget has subsequently been bound to a field of some other occurrence. Any actions done on the widget affect the widget primarily. Depending on the type of widget, the widget may influence the field value or field properties.

    By definition, a widget is always in view, so scrolling through multiple occurrences causes a different field to be bound to the widget as the data is scrolled. Calling $widgetoperation on a field that is not visible (for example, scrolled out of view), results in an error and the widget operation is not performed.

    Note: For this reason, $widgetoperation should not be used if you want to change the displayed content based on the occurrence being displayed.

    If you want the widget to display different content in each occurrence, you should change the value of the field rather than using widget operations. Alternatively, you could use the Form Container widget to embed a form that contains the widget and use $widgetoperation to manipulate the content of the contained instance. > Effect of Widget Operations in Multi-Occurrence Lists Hope this helps. Daniel

    Author: diseli (daniel.iseli@uniface.com)
  3. Hi Gilles, Hi Daniel, thanks for anwser, but in this case i can't use Form Container, because this form has to be Modal. Lars

    Author: lorenzen (lorenzen@ahp-gmbh.de)
  4. Hi Lars, Thanks for the info. In that case, you just have to avoid loading/showing more occurrences than can be displayed without using a scroll bar. E.g. when you have an entity repetition of 5 then only load 5 occurrences at a time (and this should make sure that the widget belonging to a specific occurrence always shows the same content). If you have to show more occurrences than fit on screen, then you should use data paging (like you would use in a web app). Hope this helps. Daniel

    Author: diseli (daniel.iseli@uniface.com)
  5. Hi Daniel, thank you for this information. I'll try it. Is it posible to get number of displayed Occurrences in an Entity? Lars

    Author: lorenzen (lorenzen@ahp-gmbh.de)
  6. Hi Lars, The function $paintedocc returns the number of painted occurrences of the current or the specified entity. Hope this helps. Daniel

    Author: diseli (daniel.iseli@uniface.com)
  7. $paintedocc Return the number of occurrences painted for the specified entity. $paintedocc{(Entity)}  

    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  8. Thanks Daniel, Iain, this is a solution i can work with. Lars

    Author: lorenzen (lorenzen@ahp-gmbh.de)