I am looking at some code that is failing in current versions of Chrome and IE 11. It errors because of the line:
var form = window.frameElement.document.forms[0];
With error:
"JavaScript runtime error: Unable to get property 'forms' of undefined or null reference"
Window and frameElement exist but the document is null.
The context of the above is a popup window take a zip code, displays some results and a "select" button. On click of the button calls a method which calls the above line to then assign the selected location into some values.
returnValues(id, name){
var form = window.frameElement.document.forms[0];
form.ctl00$MainContentPlaceHolder$uxResControl$uxRenLoc$RenLocCodeField.value = id;
form.ctl00$MainContentPlaceHolder$uxResControl$uxRenLoc$RenLocNameField.value = name;
...
}
With these nested user controls I am a bit confused as to how to "drill" down and assign the selected value to the hidden value RenLocCodeField or RenLocNanmeField.
Using usual ASP.NET Javascript query is always a pain!
instead of the following line:
you can use the following lines in javascript method, assuming
RenLocCodeFieldandRenLocNameFieldare theIDs generated for the respective fields.