Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote Scripting to fill Combo Boxes 1

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
I have a few combo boxes (about 20 actually) on a page and I want to fill the next one in line according to what is selected in the previous one. This has had me pulling my hair out for about 2 weeks now. I have read the MSDN article on RemoteScripting and think this may be the way to go. I've read it over and over again and just can't seem to figure out how to code the page. IMHO the article just isn't real clear. I have Remote Scripting enabled in the client and server page. Can someone please help me figure this out. Rob
Just my $.02.
 
Will it even work? Rob
Just my $.02.
 
I have done this before but the code I used is at work. I will post to this thread tomorrow how I have used this.

One note though. I have only used this on intranet web applications. I have not tested this but I have heard that you may have problems with remote scripting on the internet.

Another way to do it is what I call poor man's remote scripting. You put the web page in two frames with one frame's size set so that it doesn't show. Using JavaScript in the visible page, you post the hidden page to the server to do the work. When the hidden page loads, use JavaScript to populate dropdown boxes on the page the user see.

Thanks,

Gabe
 
A few notes to using Remote Scripting.

First, debugging is extremely difficult. You get the same misleading error message no matter what the problem is. If there is any error while processing on the server, you get a message similar to “Remote Scripting not supported on this page.” My suggestion is to start your functions in the asp file small and write it one step at a time testing as you go. Don’t write the entire function and then try to debug it all at once. You will be pulling your hair out.

Second, you must have the _scriptlibrary files installed on your server for this web application. I’m not positive about Front Page but Visual Interdev installs these for you when you create a project.

Third, I don’t remember for sure but I think your web page that makes the remote scripting call must be in the same directory as the page it is calling.

Fourth, good luck. Remote Scripting is fun to work with and I have used it in more than one intranet application. It makes your web applications function nicely but it can cause you a lot of headaches too.

Last, I have seen other implementations of Remotes Scripting but this works best for me. It works in both IE and Netscape the last I checked.

Thanks,

Gabe


****************************************************************************

Code:
index.html

<html>
<head>
<script language='JavaScript'>

function displayResults( co ) {
	var data = co.return_value;
	alert ('Result = ' + data);

}

function showError(co){
 	alert(co.data + &quot;\n&quot; + co.content + &quot;\n&quot; + co.message);
}


function DoSomeWork( NumToMultiply ) {
	//Page with code, Function in CalledPage, Value to pass in, Function to run on return from server,  Error function
	RSExecute( &quot;CalledPage.asp&quot;, &quot;MultiplyBy2&quot;, NumToMultiply, displayResults, showError);
}

</script>


</head>
<body>

<input type=button onClick='DoSomeWork(5);'>

</body>
</html>





CalledPage.asp


<% @ LANGUAGE=VBSCRIPT %>
<%
Class clsDoSomeWork

	Function MultiplyBy2(ValueIn)
		MultiplyBy2 = ValueIn * 2
	End Function

End Class

'This statement is requred.  It instantiates the class
Set public_description = new clsDoSomeWork


'This statement is required
RSDispatch

'Make sure the path in the following line is correct for your server.
%>
<!--#INCLUDE FILE=&quot;../_scriptlibrary/rs.asp&quot;-->
 
Thanks Gabe, I appreciate your time. Rob
Just my $.02.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top