Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to customize h:selectManyListbox ?  RSS feed

 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to limit the user so that he can select only three records at a time. For displaying we are using h:selectManyListbox. Do we have any idea how to achieve this?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just make use of Javascript and to make it robust, validate the size of selected items at the server side.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can do this but the functionality where it is used contains a search query builder which works on Ajax. So server side validations will be like patch in a beautiful silky cloth. Is there nay other work around we can think of?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are already using ajax, server side validation would just be less painful (i.e. no synchronous request needed).
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... this seems good... every time the user clicks we can check at the server side the number of selections.

Thanks for your reply Bauke.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!