Clear data after change

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

Clear data after change

akail
Hi,

Maybe you can explain how to clear the data of control when change value?


I try do that, but it not work properly. I use

 <xf:setvalue ev:event="xforms-value-changed" observer="control-1-control"
                         ref="instance('fr-form-instance')/section-7/control-6"
                         value=""/>

Source: https://gist.github.com/anonymous/9909863


Why I can use this?

<xf:action ev:event="xforms-enabled"> 
                                        <xxf:script>
$(document).ready(function(){
  $("$control-2-control").click(function(){
    $("$control-1-control").val('');
  });
});
</xxf:script>

 </xf:action> 


Also if I use <xf:setvalue>  autocomplete field doesn't do anything, do not become empty.
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

Erik Bruchez
Administrator
Instead of:

    value=""

try:

    value="''"

or simply omit the `value`attribute.

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

Re: Clear data after change

akail
Thanks for suggest, but it does not help. In autocomplete control not clear data when I use <xf:setvalue>
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

akail
Maybe You can tell me how I can clear data from autocomplete field with <xf:setvalue>?
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

Alessandro  Vernet
Administrator
Hi Jovita,

Could you create a minimal example where you try to do this and it fails? (I looked at your original example, but it seems to be doing something else, with a number of fields, and no autocomplete.)

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

akail
Hi, Alex,


I re-tested the AutoComplete data erasing and realized that if the field is visible, then cleaned the data. If AutoComplete is not visible after the abolition of value, an error is displayed and the data is not cleared.

I guess I should wait Orbeon 4.6 version because bug is fixed:

https://github.com/orbeon/orbeon-forms/issues/1460
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

Alessandro  Vernet
Administrator
Hi Jovita,

Indeed, this might be it. But since we "just" released 4.5, 4.6 might be a couple of months out. So if you want to test that the fix solves your issue, you could take the file that was impacted by the change (autocomplete.xbl linked below), and place it in your WEB-INF/resources/xbl/orbeon/autocomplete/autocomplete.xbl. Create the necessary directories under WEB-INF/resources, and this will override the autocomplete.xbl that comes with the build.

https://github.com/orbeon/orbeon-forms/blob/6256923a624b16a38fa2c65200eabb09278a81ae/src/resources-packaged/xbl/orbeon/autocomplete/autocomplete.xbl

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clear data after change

akail
Hi Alex,

Thanks, it helps!

I would like to ask You about the data values clearing after control changed the value. As You  can see in my source (link below) I have been using a very simple and in my opinion not logic method for this procedure. I just write in each control a action and mention all controls. But if I do have about 100 control it becomes difficult.


https://gist.github.com/11174940.git


Maybe there is an even easier way?