Hi All,
Still writing HTA's and learning .
I have an HTA with a button; when pressed opens a child window using [tt]showModalDialog[/tt]. For the vArgument (MSDN ref), I am passing an instance of the dictionary object from the following function:
Sorry about the commented code. Trying to show my workings.
I am trying to populate the dictionary object with values from text boxes in the parent window. The [tt]MsgBox fN & " " & lN[/tt] shows what I would expect, then I get the error: [tt]Object required: 'window.parent.document.getElementById(...)'[/tt]. The line reportedly in question is [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt].
It seems to me that once the child form opens, it no longer knows what [tt]myForm1[/tt] is. So the question is, how does one reference a form in the parent window to the child window? I would have thought explicitly telling the child where the form is [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt] would have done the trick. Clearly not :-(.
My other thought is why does the child form need to know what [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt]is. Surely it's stored in the dictionary object?
Any pointers suggestions would be greatly apreciated (as always).
BTW, if I comment out the fN & lN and comment in the stringA/B items from [tt]oDataDict[/tt], it appears in the child form as expected.
Many thanks
Woter.
Still writing HTA's and learning .
I have an HTA with a button; when pressed opens a child window using [tt]showModalDialog[/tt]. For the vArgument (MSDN ref), I am passing an instance of the dictionary object from the following function:
Code:
Function collateForm()
Set oDataDict = CreateObject("Scripting.Dictionary")
[aqua]'Set oForm = document.getElementById("myForm1")[/aqua]
[aqua]'fN = myForm1.txtFirstName.Value[/aqua]
[aqua]'lN = myForm1.txtLastName.Value[/aqua]
fN = window.parent.document.getElementById("txtFirstName").value
lN = window.parent.document.getElementById("txtLastName").value
[aqua]'D1_Val = oForm.txtFirstName.Value[/aqua]
MsgBox fN & " " & lN [aqua]'& " " & D1_Val [/aqua]
oDataDict.Add "firstName", fN [aqua]'"stringA"[/aqua]
oDataDict.Add "lastName", lN [aqua]'"stingB"[/aqua]
Set collateForm = oDataDict
End Function
Sorry about the commented code. Trying to show my workings.
I am trying to populate the dictionary object with values from text boxes in the parent window. The [tt]MsgBox fN & " " & lN[/tt] shows what I would expect, then I get the error: [tt]Object required: 'window.parent.document.getElementById(...)'[/tt]. The line reportedly in question is [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt].
It seems to me that once the child form opens, it no longer knows what [tt]myForm1[/tt] is. So the question is, how does one reference a form in the parent window to the child window? I would have thought explicitly telling the child where the form is [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt] would have done the trick. Clearly not :-(.
My other thought is why does the child form need to know what [tt]fN = window.parent.document.getElementById("txtFirstName").value[/tt]is. Surely it's stored in the dictionary object?
Any pointers suggestions would be greatly apreciated (as always).
BTW, if I comment out the fN & lN and comment in the stringA/B items from [tt]oDataDict[/tt], it appears in the child form as expected.
Many thanks
Woter.