Can do some other task when cancel button was clicked.

Can do some other task when cancel button was clicked.

Hi,
I've two forms form1 & form2. When cancel button in form2 was clicked, record inserted by form1 should also be deleted.

I tried with stateless form. But both forms should contain 'file upload' field which was not provided for stateless form.

Please suggest me how can I do this? 

Regards,
Appadmin