returning value from popup

I want to return a value from the popup window back to a text box in my servlet. I am using window.opener.forms[0].txtbox.value = somevalue But it is giving the error object not found. I have a form in my popup window as well in my servlet. Please help me out...