Howdy.
Passing a string to a VBScript function from a JavaScript function and I get
Microsoft JScript runtime error: Object expected.

Code snippet below.

Have an asp.net page with a asp.net textbox. When user moves off, runs a function that checks the text and displays message if text has more than 6 lines (50 chars per line).
So if lines <= 6 then save it so it can later be accessed via VBScript and inputted to a main frame screen.

Thought one way is to place this into a session var - could be wrong. Tried placing array into hidden field but it delimited the elements with commas so it may occasionally have double commas if at the 50 char limit.

Tried passing array to VBScript function and received err. Then researched and found JS array can't be passed but string can...so tried this but again ran into the object expected error.

Currently, code snippet in on default page but would like to move it to external JS and VBScript files. Any issue?

Appreciate your comments/suggestions,

Rey



Code:
    <script type="text/vbscript" language="vbscript">
	  function DefaultAddToSession(arrayNote, varName)
		' purpose: place array into session variable
		dim isSuccess
		dim arrayNote
		isSuccess = false
    	
		' in order to use an obj
		'set arrayNote = arrNote
    	
		if ((UBound(arrayNote) > 0) AND (Not varName = "")) then
		  session(varName) = arrayNote
		  isSuccess = true
		end if
      
		' rtn
		DefaultAddToSession = isSuccess
        
	  end function  
    
    </script>
    
    

    
    <script type="text/javascript" language="javascript">
	      function DefaultSendArrayToSession(aNote, sessVar)
		  {
			// purpose: receive array containing lines of note and session variable name
			//          place into session using vbscript
			// return: true if success, false if not
      	  	
      	  	var arrayNote = aNote;
      	  	var varName = sessVar;
      	  	var x;
      	  	var stringNote;
      	  	stringNote = "";
      	  	
      	  	// can't pass js array to vbscript so based on google search n
      	  	// create a long string separated by "line:"
      	  	// if try to use hidden field, then a comma is automatically added to each element value
      	  	// which then requires more pasing...
      	  	for(x=0; x<aNote.length; x++)
      	  	{
      	  	  stringNote += "LINE-" + aNote[x].toString();
      	  	}
      	  	
      	  	alert("Results of converting array to long string:" + "\n\n"
      	  	   + stringNote);
      	  	     
			// this is vbscript func
                                      // Microsoft JScript runtime error: Object expected occurs on accessing this function
			var isSuccess = DefaultAddToSession(stringNote, varName);
			alert("Array added to Session: " + isSuccess);
      	  
			return isSucess;
      	  
		  }          
    
	</script>