AutoComplete Old Value Stays Selected

UI Components for JSF
Post Reply
fenerlee1907
Posts: 4
Joined: 09 Apr 2013, 15:30

11 Apr 2013, 15:46

Hello,

These are my jars and version information:

Primefaces 3.5
JSF 2.1
Spring 3.2.0
Spring Security 3.1.3
JDK 1.7
Glassfish 3.1.2

My problem is about autocomplete component. I have a multiple selection autocomplete component in my form which has other fields (some of them are required). There is one or there are more than one value is selected in my autocomplete component and I try to remove them and post my form. My form is not validated because of required fields but strangely all of the values in my autocomplete component (which I was deleted) are appeared and selectected again.

I've tried setting required field to true, false; I've also tried to set a custom validator... no difference at all.

I hope that somebody can help me. I've googled and searched in the forum but could not find any related topic.

Thank you.

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

11 Apr 2013, 16:13

You probably need to propagate the changes in your autocomplete field by using the valueChangeListener to handle this.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

fenerlee1907
Posts: 4
Joined: 09 Apr 2013, 15:30

11 Apr 2013, 16:23

Yes, probably. There are other ways of doing this by handling the values on the server side but it looks strange. I mean that when I do the same scenario with selectManyMenu, there are no problems, the unchecked values remain unchecked when form validation fails. It looks like there is a bug. It will not happen on common issues for most of the people but still very annoying. I still hope there is a better way of solving this.

Thank you for your idea.

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

11 Apr 2013, 16:34

fenerlee1907 wrote:Yes, probably. There are other ways of doing this by handling the values on the server side but it looks strange. I mean that when I do the same scenario with selectManyMenu, there are no problems, the unchecked values remain unchecked when form validation fails. It looks like there is a bug. It will not happen on common issues for most of the people but still very annoying. I still hope there is a better way of solving this.

Thank you for your idea.
The thing with autocomplete is that selected values are passed to the server via an AJAX call when they are selected.
One would assume that this should also hold true for the case when you delete a selected item too and by checking with a PF 3.4.1 project of mine this is the indeed the case, deleting autocomplete selected items in multiple mode works as expected and doesn't show the behaviour you have described.

SelectManyMenu won't trigger an partial submit on its own, you have to do that yourself with a <p:ajax update="..."> for instance.

Check for JavaScript errors and/or create a test case which reproduces this and create an issue if this really is a bug (which it may well be).
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 86 guests