Toggle Modal Dialog from serverside

I need to toggle Modal Dialog from Server-Side. Can anyone please suggest me procedure to do that. I don’t want to use Java Script to perform this task.

Hi Anand,

I dont think that this will be possible as only the client side will know, which state the dialog has for the current session.

When there are several client sessions, where the dialog has different states for different sessions, how will you determine which client has which state and should be toggled accordingly on the server side?

I might be wrong, but lets see what others comment on this.


Ohh… okok … If Handling from Server side is not possible than Can you please suggest some solution for below mentioned problem :

Problem in Detail :

I have two Portlets in my Project (Let’s say Portlet A and Portlet B). Portlet A has a button(Name: LoadFile) which when clicked sends some data and calls an Action defined in PortletB using Portlet URL Script.
Portlet B displays table data based on information received from PortletA.The table data defined in Portlet B can be edited by User.

Expected Condition :

If user clicks on ‘Load File’ button(PortletA) without saving changes done to table in (PortletB) a modal Dialog should appear that asks user to either save changes or Discard changes before loading another file.

Outcome : I cannot have any button on PortletB.

You did not specify what version of MWS this is for. In 9.10, it is possible for an action handler to respond with script to run on the client side. If you are on 9.10 then I can give you an example of how to do that.

For earlier versions, in order to toggle a modal dialog open from the server side would require you to either:

  1. Render a script block control as part of the panel that is being refreshed by the async command that runs a script that toggles to dialog open
  2. Render a “Control/Toggle/Initiate Toggle” control as part of the panel that is being refreshed by the async command.

If your goal is actually to block the browser navigation when there are changes in some form that have not been posted back to the server, then the CAF framework doesn’t have an out-of-box solution that provides capability automatically for you. However, all the pieces should be in place for a custom script to accomplish that with some work by keeping track of the original form values and comparing them to the current values before allowing the current page to be unloaded.

If there are areas that you or a customer would like to be improved in documentation or functionality, then you can make a proposal in brainstorm @ for consideration in a future release.

Hi Eric,

Thanks for the suggestion.Actually we have also been thinking something like this in similar direction but currently we are failing to implement something like this due to lack of capabilities.