Re: How to make a popup page for exception handling?

2009-01-28 Thread Mo Wu

Hi my wicket friends,

There is fast way to make the popup for exception handling:

try {
...
} 
catch (Exception e){
target.appendJavascript(String.format(alert('%s'),
e));
}

and AjaxSubmitLink is used.

-Mo Wu


Michael O'Cleirigh wrote:
 
 Hi Mo,
 
 I tried them, I can generate the modal Window. but the AjaxLink is not
 submit
 link for a form. I need to show the error message only if there is form
 processing error.
 Should I use AjaxSubmitLink instead? or do you have some examples similar
 to
 this condition?

   
 If the alerts you want to show are tied to the existence of form 
 processing errors then prehaps you should subclass FeedbackPanel to add 
 in a javascript popup alert in addition to/replacing the standard 
 behavior of displaying the form errors in an unordered list?
 
 Or you could create a panel consisting of the modal window and the 
 activation link but tied to the existence of feedback messages.  If 
 there are zero feedback messages (the form not submitted yet case) you 
 can have the panel invisible to start with (i.e. the link would not be 
 there or say something like 'No Errors').  When there are errors present 
 the link would be visible (or say something link 'There are X errors')  
 clicking the link would show the modal window with the errors.
 
 Normally feedback messages are expected to be consumed by the feedback 
 panels during the rendering phase so they are cleared at the end of the 
 form submission request; you might have to cache it somewhere so that 
 the modal window will have the data available it since it populates 
 itself via an ajax update after the form submitting request that 
 generated the errors has already finished. 
 
 Regards,
 
 Mike
 
 cheers, :)
 Mo


 Newgro wrote:
   
 Fkleinko wrote:
 
 To show the ModalWindow you need an AjaxRequestTarget.
 where do you get that from?

   
 AjaxLink theLinkThatWillShowTheModalWindowIfItsClicked = new
 AjaxLink(...)
 {
   public void onClick(AjaxRequestTarget target) {
 myModalWindow.show(target);
   }
 }

 Please check the examples i gave you. It's all there.

 Cheers
 Per

 

   
 
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21709550.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Mo Wu

what is the type of the errorWindow? Is the errorWindow a new page or a part
of the existing page?

Best regards,

Mo 


Newgro wrote:
 
 
 I know how to show the exception in a feedback panel. But how to make the
 popup dependent on the results of submission
 You could add the errorWindow to your page and in your catch you can 
 show it. But it's only working with ajax.
 
 add errorWindow to markup and in class.
 
 try {
   exceptionalCode();
 } catch (TheExpectedException e) {
   errorWindow.setModel(new Model(e));
   errorWindow.show();
 }
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 


-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21600597.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Newgro

Its a ModalWindow. Sorry for being unclear here.
Check this for usage 
http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
http://www.wicket-library.com/wicket-examples/ajax/modal-window.1 

There you can find the sources (right upper corner) on howto use it with
page in it and so on.

HTH
Per
-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21601120.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Fkleinko

To show the ModalWindow you need an AjaxRequestTarget.
where do you get that from?




Newgro wrote:
 
 Its a ModalWindow. Sorry for being unclear here.
 Check this for usage 
 http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
 http://www.wicket-library.com/wicket-examples/ajax/modal-window.1 
 
 There you can find the sources (right upper corner) on howto use it with
 page in it and so on.
 
 HTH
 Per
 

-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21604441.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Newgro


Fkleinko wrote:
 
 To show the ModalWindow you need an AjaxRequestTarget.
 where do you get that from?
 

AjaxLink theLinkThatWillShowTheModalWindowIfItsClicked = new AjaxLink(...) {
  public void onClick(AjaxRequestTarget target) {
myModalWindow.show(target);
  }
}

Please check the examples i gave you. It's all there.

Cheers
Per
-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21604547.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Mo Wu

I tried them, I can generate the modal Window. but the AjaxLink is not submit
link for a form. I need to show the error message only if there is form
processing error.
Should I use AjaxSubmitLink instead? or do you have some examples similar to
this condition?

cheers, :)
Mo


Newgro wrote:
 
 
 Fkleinko wrote:
 
 To show the ModalWindow you need an AjaxRequestTarget.
 where do you get that from?
 
 
 AjaxLink theLinkThatWillShowTheModalWindowIfItsClicked = new AjaxLink(...)
 {
   public void onClick(AjaxRequestTarget target) {
 myModalWindow.show(target);
   }
 }
 
 Please check the examples i gave you. It's all there.
 
 Cheers
 Per
 

-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21605575.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-22 Thread Michael O'Cleirigh

Hi Mo,


I tried them, I can generate the modal Window. but the AjaxLink is not submit
link for a form. I need to show the error message only if there is form
processing error.
Should I use AjaxSubmitLink instead? or do you have some examples similar to
this condition?

  
If the alerts you want to show are tied to the existence of form 
processing errors then prehaps you should subclass FeedbackPanel to add 
in a javascript popup alert in addition to/replacing the standard 
behavior of displaying the form errors in an unordered list?


Or you could create a panel consisting of the modal window and the 
activation link but tied to the existence of feedback messages.  If 
there are zero feedback messages (the form not submitted yet case) you 
can have the panel invisible to start with (i.e. the link would not be 
there or say something like 'No Errors').  When there are errors present 
the link would be visible (or say something link 'There are X errors')  
clicking the link would show the modal window with the errors.


Normally feedback messages are expected to be consumed by the feedback 
panels during the rendering phase so they are cleared at the end of the 
form submission request; you might have to cache it somewhere so that 
the modal window will have the data available it since it populates 
itself via an ajax update after the form submitting request that 
generated the errors has already finished. 


Regards,

Mike


cheers, :)
Mo


Newgro wrote:
  

Fkleinko wrote:


To show the ModalWindow you need an AjaxRequestTarget.
where do you get that from?

  

AjaxLink theLinkThatWillShowTheModalWindowIfItsClicked = new AjaxLink(...)
{
  public void onClick(AjaxRequestTarget target) {
myModalWindow.show(target);
  }
}

Please check the examples i gave you. It's all there.

Cheers
Per




  




How to make a popup page for exception handling?

2009-01-21 Thread Mo Wu

Dear experts,

I have one feature to be implemented, but I dont know how to do that:
I have one page, there is a form need to be submitted. after submitted, 
  1. If the results is correct, then the same page is returned.
  2. if there are some exceptions, then a popup need to be shown up and it
should also show the errorMessage. 

I know how to show the exception in a feedback panel. But how to make the
popup dependent on the results of submission.

Thanks for help!

Best regards,

Mo

-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-popup-page-for-exception-handling--tp21588129p21588129.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to make a popup page for exception handling?

2009-01-21 Thread Per Newgro



I know how to show the exception in a feedback panel. But how to make the
popup dependent on the results of submission
You could add the errorWindow to your page and in your catch you can 
show it. But it's only working with ajax.


add errorWindow to markup and in class.

try {
 exceptionalCode();
} catch (TheExpectedException e) {
 errorWindow.setModel(new Model(e));
 errorWindow.show();
}

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org