On 10/25/07, Swaroop Belur <[EMAIL PROTECTED]> wrote:
> Do it like this:
>
> In js file
>
> function yourconfirmationjsfunction( urltogotoonok , urltogotooncancel) {
>
>
>     var retValue =  confirm(" Are you sure ");
>     if(retValue == false){
>      window.location.href=urltogotooncancel;
>     }
>
>      window.location.href=urltogotoonok ;
> }

You can even do it completely generic, e.g. like this:

        private static class AlertMessageContributor extends HeaderContributor {

                public AlertMessageContributor(final AlertMsg alertMsg) {
                        super(new IHeaderContributor() {

                                private static final long serialVersionUID = 1L;

                                public void renderHead(IHeaderResponse 
response) {
                                        
response.renderOnLoadJavascript("alert('"
                                                        + alertMsg.getMessage() 
+ "');");
                                }
                        });
                }
        }


...

        Page page = requestCycle.getResponsePage();
        if (page != null) {
                page.add(new AlertMessageContributor(alertMsg));
        }


Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to