Losing Form Data When Dismissing Modal


I have a dynamically generated form which also enables the user to capture a picture from his mobile camera and set it as his profile picture. I also have a modal which has a signature-pad component which captures the signature. However, I am losing the image previously captured when I dismiss the modal. Can anybody help me out?