This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes ajax and p:picklist (PrimeFaces) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ajax and p:picklist (PrimeFaces)" Watch "ajax and p:picklist (PrimeFaces)" New topic
Author

ajax and p:picklist (PrimeFaces)

massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

Hello guys, here the issue:
I need to update the disable attribute of a commandButton based of the number of item in the picklist target, in particular if the target size is 0 the button must be disabled.
here my code (i'm using PrimeFaces 3.4):
Face:


Bean:


The idea was to use the setter method of the pickSize component in a non-ortodox way...
So, when an user transfer an item, the ajax will execute the hidden inputText trought its setter that in turn will set the size value in the pickSize, and finally it will change the value of the disabled attribute of the button.
...I have this is the track error:
any suggestion? thanks guys.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You're doing this the hard way. The hidden control is not going to gain you anything.

You're also not defining the selectItems properly for the pickList. Unfortunately, you didn't include the definitions, and the stacktrace error messages for dropdown list-style controls are famously useless, so we'll need specific data.




Customer surveys are for companies who didn't pay proper attention to begin with.
massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

thanks for the answer, i have sorted out the problem in this way:



ajax now works.
Anyway it evaluates the target size before the transfer, so it's always one click shifted...
how can I sort out it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ajax and p:picklist (PrimeFaces)