Delete autocomplete values in a repeat grid

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

Delete autocomplete values in a repeat grid

akail
Hi,

How is possible to delete autocomplete values which are in repeat grid, when other control value has changed?


For example, I have a control of radio buttons "control-1" and a repeat grid in which is autocomplete control "autocomplete-1".
So when "control-1" value is changed then all values of autocomplete should be deleted.

I use this action:

<xf:action ev:event="xforms-value-changed" ev:observer="control-1-control">
        <xf:var name="value" value="xxf:value('control-1-control')"/>
        <xf:dispatch target="autocomplete-1-control" name="fr-set-label">
                <xf:property name="label" value="$value"/>
        </xf:dispatch>
</xf:action>


But it delete only first autocomplete value.
So maybe you know how write an action which delete all autocomplete values which are in repeat grid?
Reply | Threaded
Open this post in threaded view
|

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Hi Jovita,

Are you saying that you have, inside a repeat, a radio button and an autocomplete, and that when a value is selected with the radio button, you would like to reset the value of the autocomplete on the same row (but not of autocompletes on different rows)?

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

Re: Delete autocomplete values in a repeat grid

akail
Hi Alex,


Inside a repeat grid is only one autocomplete. A radio button is in another simple grid, which is before repeat grid.

I send you a link to my form source:
https://gist.github.com/1dec917db39b5237ecdb.git

And add a video link: http://screencast.com/t/ULaj1Zdg

Maybe that will be clearer.

I also recognized that an autocomplete value has been deleted, if the field was active.


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

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Jovita, got it, and what is the behavior you'd like to have? That all autocomplete should be reset when the value of the radio button is changed? There should be no change the number of iterations added?

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

Re: Delete autocomplete values in a repeat grid

akail
I would like, when value of the radio button is changed, then all autocomplete values would be reset.

Of course it would be great, if added the number of iterations would be reset to only one, but it isn't necessary.


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

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Hi Jovita,

Got it. Here is a full example that does this:
https://gist.github.com/avernet/90dce077e49d8da73fcd

And the important part is in this action, manually added to the source, inside the xf:model:

<xf:setvalue ev:event="xforms-value-changed" observer="my-radio-control"
    iterate="/form/my-section/my-countries/my-countries-iteration"
    ref="my-country"/>

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

Re: Delete autocomplete values in a repeat grid

akail
Hi Alex,

Thanks for your help, it works :)


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

Re: Delete autocomplete values in a repeat grid

akail
It works when the  repeat grid doesn't have visibility control.

But if I add a visibility control ($my-radio="1"), then it not work at all.


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

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Hi Jovita,

I am not following you. Could you maybe modify the example I created to reproduce the problem, and respond attaching the modified version along with the steps I would need to follow to reproduce the problem?

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

Re: Delete autocomplete values in a repeat grid

akail
Hi,

I edited form, which you sent and I noticed that my structure of repeat grid template is different than yours.

My repeat grid template is like that:

<repeatgrid>
<autocomplete label=""/>
</repeatgrid>

Your repeat grid template:

<repeatgrid>
<repeatgrid-iteration>
<autocomplete label=""/>
</repeatgrid-iteration>
</repeatgrid>

And in your form I don't see autocomplete field (see in video).

I also filled in the form, saving it and noticed that the autocomplete values are not deleted, only hidden.

Source:
https://gist.github.com/7670f9c49ee970995791.git

Video:
http://screencast.com/t/dO572jOW

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

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Hi Jovita,

I can see the video, but somehow the link to the source doesn't work for me: I'm getting a 404 page in return. Could you double check that link, or simply attach the source to your response?

In the video, the problem seems to be that the value comes back when you move the autocomplete in the repeat. Is that correct? I.e the value is reset when you click on the radio, but then reappears when you move the position of the autocomplete. If that is the case, could you add an XForms Inspector, and check if it is reset in the XML? I suspect it might be, but that the value somehow stays on the client somehow, which obviously would be a bug.

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

Re: Delete autocomplete values in a repeat grid

akail
Hi Alex,

Form source:
https://gist.github.com/anonymous/7670f9c49ee970995791


The value of the autocomplete does not clear.
I saved the form, then checked the XML document in the database, the value is left.
Also, if you save the form and then refresh your browser, value of autocomplete appears (see at video).

Video:
http://screencast.com/t/Upoeglyf


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

Re: Delete autocomplete values in a repeat grid

Alessandro  Vernet
Administrator
Hi Jovita,

I am not sure to follow you: what is wrong with the behavior you're seeing in the section "Your example", and what would you like instead?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet