Forum Discussion
eli_donahue
8 years agoCommunity Manager
Quick note: The "contentDocument" object only exists when using Chrome. You can use this instead to support Chrome, IE, and FF:
// Get the parent form
var parent_form = parent.parent.document.getElementById("instance");
if (parent_form && parent_form.contentWindow)
parent_form = parent_form.contentWindow.document;
// Get the field and set the value. Use <tag_name>.<property_name> for the query selector.
var field = parent_form.querySelector("input.item_number");
field.value = "123";