How to update html form field values through an Activex Control

Hi All,

I would really appreciate if anyone can help me in solving this issue.

1. We have a html page that calls an activex control in a child window.
2. Once the user selects any listing on the activex control and clicks ok,
3. We need to populate the parent window form fields with user selection.

I found plenty of threads talking about how to pass value from html page to activex control,
but in our case we need some return values back from activex control that will set more than one hidden field.

Here are some logical steps that we need to have :

On parent html page..

<script language="VBScript">
Sub test  
Call ActivexControl (pass parent windows handle);

On activex side :

1. Do the processing ...
2. Build the output strings
3. Get the window handle ,
4. Set window.document.forms[0].firstField.value=<some value>
5. Set window.document.forms[0].secondField.value=<some value>
6. Close the popup window...focus back to parent window.

Any help would be highly appreciated.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What about having the ActiveX control fire an event that includes the field name and field value?  Then you could just put an event handler in your HTML that will update the form fields.  Something like (warning--air code)....

(in the ActiveX control)
Public Event ValueChange(ByVal Key As String, ByVal Value As Variant)
RaiseEvent ValueChange("ApptTime", #2:30PM#)

(in the HTML)
<script language=vbscript>
Sub oMyObject_ValueChange(ByVal Key, ByVal Value)
    Select Case Key
        Case "ApptTime": txtApptTime.value = Value
    End Select
End Sub
<object id=oMyObject .... (yada yada)>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.