Hi all,
I have a project where I have a new window called based on a text field in the parent window. The new window is called correctly and everything opens fine. I retain a pointer to the new window in the parent window.
The problem is, I can't write anything from the parent window to the child window.
So, without further ado, here's the code in question:
As you can see, i use the onchange event. Without going into too much detail, I check the new value against an array, and if it isn't in there, it pops open the new window which is a form to add this 'requestor'.
However, when I open the new window, I have no text in the lname input element .
If anybody has any experience and can explain this behavior to me, I'd appreciate it.
edit: And I know my javascript sucks. I'm just learning it, and quite frankly, I think the language was designed by someone clinically insane.
I have a project where I have a new window called based on a text field in the parent window. The new window is called correctly and everything opens fine. I retain a pointer to the new window in the parent window.
The problem is, I can't write anything from the parent window to the child window.
So, without further ado, here's the code in question:
Code:
<input type="text" id="requestor" name="requestor" value='' onChange="newRequestor( this )" />
<script>
requestorList = new Array( {REQ_LIST} );
actb(document.getElementById('requestor'),requestorList);
function newRequestor( obj )
{
var newUserEntry;
found = false;
for( var i = 0; i < requestorList.length; i++ )
{
if( obj.value == requestorList[i] )
{
found = true;
break;
}
}
if( found == false )
{
if( confirm( "'"+ obj.value +"' not found in database, do you wish to add them?" ) )
{
if( !newUserEntry || newUserEntry.closed )
{
newUserEntry = window.open( "newRequestor.php", "newUser", "status,height=400,width=400,dependant" );
newUserEntry.document.forms["requestorForm"].lname.value="test";
} else
{
newUserEntry.focus();
}
}
}
}
</script>
However, when I open the new window, I have no text in the lname input element .
If anybody has any experience and can explain this behavior to me, I'd appreciate it.
edit: And I know my javascript sucks. I'm just learning it, and quite frankly, I think the language was designed by someone clinically insane.