?
Solved

Pass javascript variable by reference to OCX

Posted on 2007-10-12
6
Medium Priority
?
1,352 Views
Last Modified: 2008-01-09
I have an OCX (developed by myself) to be used in a web page using javascript / vbscript.
I would like to pass a variable to the OCX and then change the value of the parameter inside the OCX and then pass the new value back to the JavaScript function. It would be great if the parameter can be of type string.

Is it possible to pass the address (pass by reference) of a javascript parameter to OCX.

thank you
0
Comment
Question by:WalterRautenbach
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:dbritt
ID: 20065851
No. All javascript parameters are by value only.

WScript users often have similar questions and the answer in WScript is that there is an alternate way to call a method such that the needed value is returned.

Good luck with your project!
0
 
LVL 20

Expert Comment

by:Gawai
ID: 20066004
0
 

Author Comment

by:WalterRautenbach
ID: 20078243
thanks guys. not really what I wanted. I did get a work-around though. How does it work with the points now? Although you tried, you did not give me the right answer :)  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:dbritt
ID: 20078497
You should post your answer and request a moderator refund your points after accepting your own solution. If they deem your question truly was unaddressed, your points will be refunded.

However, your question requested changing a (preferably) string type by reference...which is not possible, last I heard. If you've got new information on this, do share. :)

If you passed a javascript object and changed a property inside the object, then that's really a different way of solving your problem but it is not a new answer to the question. :-P

Regards.
0
 

Author Comment

by:WalterRautenbach
ID: 20078640
Thanks. Yes I wanted to pass a variable to an ActiveX control and then change the value of that variable inside the ActiveX control and then pass the new value back to JavaScript. What I have done now is to leave the parameter route and rather return a BSTR* from the ActiveX control function to the calling JavaScript function. So I don't think I am changing a property of the object.

Is this what you guys said I shoud I do?
0
 
LVL 15

Accepted Solution

by:
dbritt earned 1500 total points
ID: 20079957
If you explicitly return a value, then yes, that's what I suggested. What I was telling you was it is not possible is to change a variable passed without returning something.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question