<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to create cancel or park button in my Html Dialog?</title><link>https://answers.axonivy.com/questions/2855/how-to-create-cancel-or-park-button-in-my-html-dialog</link><description>&lt;p&gt;On what should I pay attention when I want to create a cancel or a park button in my Html Dialog?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2855/how-to-create-cancel-or-park-button-in-my-html-dialog" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 08 Sep 2017 01:58:24 -0400</lastBuildDate><item><title>Answer by Alex Suter</title><link>https://answers.axonivy.com/questions/2855/how-to-create-cancel-or-park-button-in-my-html-dialog/2856</link><description>&lt;p&gt;If you want to create a cancel button or a park button in your Html Dialog, you can create &lt;code&gt;commandButton&lt;/code&gt; in your view.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p:commandButton actionListener="#{logic.park}" value="Park" update="form" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This button calls an event in which you can implement an Ivy script step where you can park now the current task.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ivy.session.parkTask(ivy.task);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now comes the tricky part. Instead of continuing the process normally, you send a redirection to the browser:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;String redirectScript = "window.location.href='"+ivy.html.taskListRef()+"';";
RequestContext.getCurrentInstance().execute(redirectScript);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The event &lt;code&gt;logic.parkTask&lt;/code&gt; should not lead to an &lt;code&gt;User Dialog Exit End&lt;/code&gt; which would close the dialog and go on with the process. It should lead to a &lt;code&gt;User Dialog Process End&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can do the same for the cancel button, but you would call &lt;code&gt;ivy.task.reset()&lt;/code&gt; instead of parking the task.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Fri, 08 Sep 2017 01:58:24 -0400</pubDate><guid>https://answers.axonivy.com/questions/2855/how-to-create-cancel-or-park-button-in-my-html-dialog/2856</guid></item></channel></rss>