Search code examples
zk

How to goto back page on click of cancel button in ZUL apge


I wanted to navigate to the browsers back page (History) onclick of Back button. How I can achieve this usign zul page? I have one option of keeping the hidden field and redirect via composer or using zk's if condition. But any other solution like javascripts function are?


Solution

  • You can use client side javascript in combination with Java Script's history object:

    <zk xmlns="http://www.zkoss.org/2005/zul">
        <div>
             <button label='back' 
                     xmlns:w="client" 
                     w:onClick="history.back();" 
             />                
        </div>
    </zk>