Web browser control: Detecting changes in form content
A form contains 开发者_运维百科many elements, such as labels, Textbox, radio options box etc
How do you detect the user has changed a textbox input value, or has choosen a radio option within the content of a web browser control? (not the winform itself).
Do you handle a winform event for when the mouse clicked or keyboard keys pressed? or is there a better way to detect changes in the web browser content?
There are "quick and easy" ways, but IMHO, a better way is to load the state of the form into javascript variables (on load), and then compare only the elements you are interested in, when navigating away, or whatever.
For example, there may be some fields that aren't so relevant (say, a different value in a minor drop-down box) but some that are very important (i.e. the contents of this message box).
It's fairly trivial to do anyway; just check the values you have currently (on the given event you are capturing, i.e. browser close) and then compare them with the ones you saved.
精彩评论