Strange behaviour with xxf:format attribute in my Xforms form (using Orbeon Form Runner) -
i have numeric input field in form. add format on xxf:format :
<xf:input id="input-control" bind="input-bind" class="question nombre" xxf:format="if (. castable xs:integer) replace(format-number(xs:integer(.),'###,###,###,###,###,###,###,###,###,##0'),',',' ') else ''">
this may bit wild it's format number 123456 presented 123 456. works great me, not users... now, added script cancel formatting when input focused (aka : go 123456 when editing field) simple js :
<xf:action ev:event="domfocusin"> <xxf:script> var input = this.getelementsbytagname('input')[0]; var valeur = input.value.replace(' ',''); input.value = valeur; </xxf:script> </xf:action>
behaviour looks ok @ first sight, mean, entered 123456, focus out , got 123 456 (format ok), focus in , got 123456 (script behaviour ok). if don't make changes on field , focus out, don't have format (still 123456 instead of 123 456). understand format applied when "needed" , "needed" means here, when value of input changes. if force xforms-value-change event still don't have format back.
anyone has idea on how achieve ?
(anyone has understood ? :-s)
this can tricky right. recommend using instead fr:number
control, of you.
Comments
Post a Comment