# Destroy error org.apache.wicket.WicketRuntimeException

**URL:** <https://forum.servoy.com/t/destroy-error-org-apache-wicket-wicketruntimeexception/7804>\
**Category:** Classic Servoy\
**Created:** [July 11, 2007, 6:43pm UTC](https://forum.servoy.com/t/destroy-error-org-apache-wicket-wicketruntimeexception/7804 "2007-07-11T18:43:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [July 11, 2007, 6:43pm UTC](https://forum.servoy.com/t/destroy-error-org-apache-wicket-wicketruntimeexception/7804/1 "2007-07-11T18:43:08Z")

</div>

This method works fine in smart client but gives the following error in webclient:

**Destroy error org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!**

```auto
// Ask confirmation
var choice = globals.mod_webdialog_showDialog('Logout','Do you really want to logout?','Cancel','Logout');
if(choice)
{
	// Transform in INT
	parseInt(choice)
}
else
{
	return;
}

if(choice > 1)
{
	// Logout and redirect to http page
	application.showURL('http://www.sintpro.com/wc/wc_logout_eng.html','_self')
	application.exit();
}

```

globals.mod\_webdialog\_showDialog():

```auto
var title = arguments[0]
var message = arguments[1]
var btn1 = arguments[2]
var btn2 = arguments[3]

if(title && message && btn1 && btn2)
{
	// Set the buttons
	forms.sintpro_webdialog_dialog.elements.btn1.text = btn1
	forms.sintpro_webdialog_dialog.elements.btn2.text = btn2
	
	// Set the message
	globals.g_webdialog_text = message
	
	// Reset the status
	globals.g_webdialog_status = null
	
	// Show the dialog
	application.showFormInDialog(forms.sintpro_webdialog_dialog,-1,-1,-1,-1,title,false,false,'webdialog_mod',true)
	
	// Return the exit status (pressed button)
	return globals.g_webdialog_status;
}
else
{
	return null;
}

```

If I do not show the dialog everything works fine, any hint?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 11, 2007, 9:57pm UTC](https://forum.servoy.com/t/destroy-error-org-apache-wicket-wicketruntimeexception/7804/2 "2007-07-11T21:57:13Z")

</div>

that error doesn’t have anything to do with your error  
the problem is that the script doesn’t stop when showing a modal dialog in the webclient.  
So your code is just executing directly.

In webclient you have to do

//script1  
showForInDialog  
// Don’t do anything

//script2 (onHide or onaction of a button of the form in dialog)  
do your stuff.

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [July 12, 2007, 8:08am UTC](https://forum.servoy.com/t/destroy-error-org-apache-wicket-wicketruntimeexception/7804/3 "2007-07-12T08:08:37Z")

</div>

Ouch!  
Thanks Johan!
