Incremental input does not work on dynamically inserted input fields referencing data type xs:time

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Incremental input does not work on dynamically inserted input fields referencing data type xs:time

Toon Andries-2
Hi,

I think I found a bug concerning input fields that reference dynamically inserted data bound to type xs:time. On those fields, the incremental input does not work.

In the attached file "timetest.xhtml" I have added an easy example:
The page contains a table with 3 columns, a column 'From', a column 'to' and a column 'Difference' (attribute total).
My default instance looks like this:
<xf:instance id="times">
     <times xmlns="">
          <time from="00:00:00" to="00:00:00" total="PT0S" />
          </times>
     </xf:instance>
With the following binds:
     <xf:bind ref="instance('times')/time/@from" type="xs:time" />
     <xf:bind ref="instance('times')/time/@to" type="xs:time" />
     <xf:bind ref="instance('times')/time/@total" type="xs:duration"
     calculate="xs:dayTimeDuration(if(starts-with(xs:string(xs:time(../@to) - xs:time(../@from)), '-'))
               then (xs:dayTimeDuration(xs:time(../@to) - xs:time(../@from)) + xs:dayTimeDuration('PT24H'))
                         else (xs:time(../@to) - xs:time(../@from)))" />
My table has a xhtml:tr repeat on nodeset instance('times')/time. Each repeated row shows two input fields (for attributes @from and @to) and an output field that shows the calculated duration (attribute @total).

I then have a button that inserts an extra time element:
<xf:instance id="new-time">
<time van="00:00:00" tot="00:00:00" totaal="PT0S" />
</xf:instance>
The action on the button looks like this:
<xf:trigger>
<xf:label>Add row</xf:label>
<xf:action ev:event="DOMActivate">
<xf:insert context="instance('times')" origin="instance('new-time')" nodeset="*" position="after" />
<xf:recalculate model="m-default" />
<xf:rebuild />
</xf:action>
</xf:trigger>
At first at didn't have the recalculate and the rebuild, but that did not work either.

Now what is the problem:
  • If you type in a time in one of the time input fields of the first row, the duration bind is immediately calculated. This is because the row was present in the default instance on load.
  • If you insert a new row and type in a time in one of the input fields of the new row, then the duration is not calculated until you click outside the input field. It seems like the inserted input field does not react to incremental changes, even if the 'incremental' attribute (set to true) is added to the input field. Even a recalculate and rebuild after the insert does not fix this problem.
I have a more advanced example that uses autosave and allows you to load previously entered instance data. If you load a from with instance data that has previously inserted rows in it, then the problem does not occur on those rows after the load. However, newly inserted rows still have the same problem.
I played around a bit with other input types like text input, but there is no problem with the increment there.

I hope you can give me some input on this.

Thanks in advance,

Toon Andries
Professional Services Consultant
Inventive Designers

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

timetest.xhtml (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Incremental input does not work on dynamically inserted input fields referencing data type xs:time

Erik Bruchez
Administrator
Toon,

Thanks, I reproduce the issue also without a repeat:

https://github.com/orbeon/orbeon-forms/issues/1609

The class xforms-incremental is always removed upon recreating an input field. I don't know yet if there was a reason for that, but clearly it is wrong at least in some cases.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Incremental input does not work on dynamically inserted input fields referencing data type xs:time

Erik Bruchez
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Incremental input does not work on dynamically inserted input fields referencing data type xs:time

Toon Andries-2
Thank you for the quick response!
We will update our Orbeon and I will let you know when I have tested this issue.

Kind regards,
Toon

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].