Sunday 7 August 2016

Preventing user Actions on a ADF page when the other process is running

Using the java Script we can restrict the user action when the other action is running
just by calling event.preventUserInput();

Calling this method prevents all user input while the event is being processed, including while the event is propagated to the server. The UI is automatically unblocked when processing for this event is complete. Ignores request for events that do not propagate to the server.


<af:resource type="JavaScript">
 function showGlasspane(event){
    event.preventUserInput(); 
  }
 </af:resource>

<af:commandButton actionListener="#{xxTestBean.SelectAll}"
      text="Select All" clientComponent="true"
      id="cb1" partialTriggers="t1">
    <af:clientListener method="showGlasspane" type="action"/>
</af:commandButton>

Steps to use:

Create jsff view based on any VO

Add the resource to the jsff





Create a button and add the clientListener  to  button and call the javascript



Create the taskflow with jsff view and place it on jsf page as region and test. you can verify,
This action in turn triggers the client side JavaScript method first, and then calls "SelectAll" action on server. You may notice the change in the mouse cursor at this stage - mouse cursor to an hourglass. And changes back to normal mode, when processing for this event is complete.