I have a form that tracks its dirty state by listening to the onChange
events of all its form fields. If the form is dirty, the user is warned about unsaved changes when he tries to leave the page or tries to select another item.
This works well with the form in a "normal page".
This form is also used inside an iframe. When changing the value of the first input field and then jumping to another field in the form, the onChange
event is triggered as expected and the form is set dirty. But when only one input field is changed and you click anywhere outside the iframe, the onChange
event of the changed input field is not triggered. It seems as if the input field does not really loses its focus, when the iframe loses it.
How can I make sure that the onChange
event is fired when clicking outside the iframe?