Clear form when user press cancel button

Dear all,

when the user press the Cancel button the form should be cleared. Is that possible?

Best wishes
Tom

Dear @TWendt,
You can try something like this:

fd.spRendered(function(){
    fd.toolbar.buttons[1].click = function(){
        if (confirm('Are you sure you want to exit the form?')) {
            fd.clear();
            fd.close();
        }
    }
});

Or without the confirmation:

fd.spRendered(function(){
    fd.toolbar.buttons[1].click = function(){
        fd.clear();
        fd.close();
    }
});

It doesn't work. I use userdefined buttons and hide the standard buttons.

.fd-toolbar-primary-commands {
visibility: hidden;
}

Dear @TWendt,
Then just copy it inside of the Click property:

fd.clear();
fd.close();