JSF 1.2 checkbox How to get instant response? - jsf

I have a column of checkboxes and I want to get this effect that when you select 3 of them the rest of checkboxes disables. I've tried everything but I can't make it to do it instantly after clicking on a checkbox (it happens when I reload a page). Every response for that problem is using <f:ajax> but I'm using JSF 1.2 (and I can't use JSF 2 in this project). Is there any way to get through my problem?
Thanks in advance!

Related

Primefaces fetch dropdown values on show

I have a strange situation where one needs to dynamically populate dropdown values. The best idea I have come up with is creating a button, which triggers ajax request that fetches new dropdown values and on complete updates the dropdown and displays it.
I was wondering if there is any other more elegant way of handling situations like this. I am using the latest primefaces version 11.0.0.
I suggest to use the p:autoComplete component with the dropdown attribute set to true instead. It allows you to get the values when the button is clicked or when a query is typed. You don't need to take care of updating the component yourself. The only thing you need to do is have a completeMethod in your bean or have a completeEndpoint (REST endpoint).
With PrimeFaces 12 you can even (re)use a LazyDataModel as a suggestions provider.

JSF Validation fails for no (obvious) reason

I have a couple of mandatory PrimeFaces 5.2 <p:autoComplete> components in my JSF 2.2 page tied to a #ViewScoped bean. The page consists of the following mandatory elements:
Employee (p:autoComplete)
Order (p:autoComplete)
Location (p:autoComplete)
WorkingTime (p:inputText)
Description (p:inputTextArea)
DaysOfBookkeeping (custom component for a multi date picker).
When I complete the form and submit the record immediately, everything works fine. When I leave the form alone for a couple of minutes before hitting the submit button, I get validation errors for "Order" and "Location", even though the values in the form are still present and the HTTP-POST is exactly the same as during the successful submit. In the HTTP-Post I can see, that the values for "Order" and "Location" are set, just like during the succesful HTTP-POST. I never get any validation errors for "Employee", even there's no difference between the three p:autoComplete elements.
javax.faces.partial.ajax=true&javax.faces.source=NewTimesheetForm%3AsH_submit&javax.faces.partial.execute
=%40all&javax.faces.partial.render=NewTimesheetForm%3Agrowl&NewTimesheetForm%3AsH_submit=NewTimesheetForm
%3AsH_submit&NewTimesheetForm=NewTimesheetForm&NewTimesheetForm%3AMain_employeeAutoComplete_input=Sebastian
+Lang&NewTimesheetForm%3AMain_employeeAutoComplete_hinput=df27af76-9937-4e28-bee8-66a000f0ce9c&NewTimesheetForm
%3AMain_dateArray_input=&NewTimesheetForm%3AMain_dateArray_datepicker=&NewTimesheetForm%3AMain_wspOrderAutoComplete_input
=Development+(Kolibri)& NewTimesheetForm%3AMain_wspOrderAutoComplete_hinput=21c2259e-08bf-4a98-b718-8be67dba3b55&NewTimesheetForm%3AMain_locationAutoComplete_input=Wien&NewTimesheetForm%3AMain_locationAutoComplete_hinput
=15e41fee-ef98-4176-a118-032cef4e4c02&NewTimesheetForm%3AMain_workingTime=12&NewTimesheetForm%3AMain_description
=123&javax.faces.ViewState=15843050982783687%3A7588832336313498775
Any ideas what might be the reason for the validation errors?
PrimeFaces 5.2
Mojarra 2.2.10
Wildfly 9.0.1
I was using the wrong converter. This is the right way to do it: http://showcase.omnifaces.org/converters/ListConverter

Primefaces Datatable Selection Large Dataset

My application is using:
WildFly 8.2
Mojarra 2.2.8-jbossorg-1 (the one that comes with WildFly).
Primefaces 5.2
JDK8
There's a page where I need to load many files (around 12k) and then show their names to the user so he/she can choose which ones they want to pick up.
And I'm able to show my datatable with the files as expected.
The problem starts when I select more than 1k rows and try to go to the next page of the datatable.
It gets incredibly slow.
I use multiple selection with checkboxes, and from what I saw every time I change the page it sends every checkbox as a parameter from the request.
I really have no idea of how to solve this. Hope someone might help with any suggestion.
Thanks

Disable JSF page for few seconds on commandButton click

I need to disable all components of a jsf page on button click and show a countdown to , say 10 sec, before the page automatically refreshes.
Please share your ideas.
If you are willing to use any 3party component library.
Use Primeface BlockUI, which can be helpful in blocking UI components.

add the code for a widget (widget.xhtml) once but use it twice in same webpage, possible ? How?

I have a widget in my application that I need to display at two places(once in main page body and once through dialog box). Currently its code has been added twice in the page. Now I was thinking, If there was a way I could just include it only once and show the same instance in the dialog box, as in the main page body.
Can you suggest a way for this?
I'm Using:-
JSF 2.0 with Facelets
Primefaces 3.0 M3 Snapshot
JSF 2 has exactly the feature you want: it's called composite components. I bascially allows you to write a bunch of Facelet code into a file and use it just like any other JSF component, pass parameters to it, etc.

Resources