Object required error 
Author Message
 Object required error

I have a comma delimited string that passes info from one asp page to
another. I am
using the  VBScript split function to create an array from the string.
The array returns
true when i check for it. however i'm unable to use the length property
for the
array.... i'm not sure why??

Here is the script code to create the string and it works great!
function newsSubmit() {
var strValues = "";
var boxLength = document.DeptForm.deptnum.length;
var count = 0;
if (boxLength != 0) {
  for (i = 0; i < boxLength; i++) {
  if (count == 0) {
   strValues = document.DeptForm.deptnum.options[i].value;
  }

  else {
  strValues = strValues + "," +
document.DeptForm.deptnum.options[i].value;
  }
  count++;
  }
 document.DeptForm.deptArray.value = strValues
 document.DeptForm.submit();

Quote:
}

Here is the code to split the string and create an array. This seems to
work find it
returns true for the array.
<%
Dept = Request.Form("deptArray")
Dept = split(Dept, ",", -1, 1)
x = IsArray(Dept)
If x = "True" then
 Response.Write "This is an array"
Else
 Response.Write "Sorry"
End if
%>

Here is the but part... when I try to access the length of the array it
returns an error
"object required"
<%
y = Dept.length
for i = 0 to y - 1
 Response.Write "News release Dept #: "%>
<%Response.Write Dept.value(i)
next
%>

Any ideas???

K



Sun, 20 Jul 2003 01:33:58 GMT  
 Object required error
VBScript arrays don't have a length property. Use the UBound function to
determine the array size:

 y = UBound(Dept)

=-=-=
Steve
-=-=-


Quote:
> I have a comma delimited string that passes info from one asp page to
> another. I am
> using the  Vbscript split function to create an array from the string.
> The array returns
> true when i check for it. however i'm unable to use the length property
> for the
> array.... i'm not sure why??

> Here is the script code to create the string and it works great!
> function newsSubmit() {
> var strValues = "";
> var boxLength = document.DeptForm.deptnum.length;
> var count = 0;
> if (boxLength != 0) {
>   for (i = 0; i < boxLength; i++) {
>   if (count == 0) {
>    strValues = document.DeptForm.deptnum.options[i].value;
>   }

>   else {
>   strValues = strValues + "," +
> document.DeptForm.deptnum.options[i].value;
>   }
>   count++;
>   }
>  document.DeptForm.deptArray.value = strValues
>  document.DeptForm.submit();

> }

> Here is the code to split the string and create an array. This seems to
> work find it
> returns true for the array.
> <%
> Dept = Request.Form("deptArray")
> Dept = split(Dept, ",", -1, 1)
> x = IsArray(Dept)
> If x = "True" then
>  Response.Write "This is an array"
> Else
>  Response.Write "Sorry"
> End if
> %>

> Here is the but part... when I try to access the length of the array it
> returns an error
> "object required"
> <%
> y = Dept.length
> for i = 0 to y - 1
>  Response.Write "News release Dept #: "%>
> <%Response.Write Dept.value(i)
> next
> %>

> Any ideas???

> K



Sun, 20 Jul 2003 03:42:35 GMT  
 Object required error
bang on that's what i did and it works great!
Quote:

> VBScript arrays don't have a length property. Use the UBound function to
> determine the array size:

>  y = UBound(Dept)

> =-=-=
> Steve
> -=-=-



> > I have a comma delimited string that passes info from one asp page to
> > another. I am
> > using the  Vbscript split function to create an array from the string.
> > The array returns
> > true when i check for it. however i'm unable to use the length property
> > for the
> > array.... i'm not sure why??

> > Here is the script code to create the string and it works great!
> > function newsSubmit() {
> > var strValues = "";
> > var boxLength = document.DeptForm.deptnum.length;
> > var count = 0;
> > if (boxLength != 0) {
> >   for (i = 0; i < boxLength; i++) {
> >   if (count == 0) {
> >    strValues = document.DeptForm.deptnum.options[i].value;
> >   }

> >   else {
> >   strValues = strValues + "," +
> > document.DeptForm.deptnum.options[i].value;
> >   }
> >   count++;
> >   }
> >  document.DeptForm.deptArray.value = strValues
> >  document.DeptForm.submit();

> > }

> > Here is the code to split the string and create an array. This seems to
> > work find it
> > returns true for the array.
> > <%
> > Dept = Request.Form("deptArray")
> > Dept = split(Dept, ",", -1, 1)
> > x = IsArray(Dept)
> > If x = "True" then
> >  Response.Write "This is an array"
> > Else
> >  Response.Write "Sorry"
> > End if
> > %>

> > Here is the but part... when I try to access the length of the array it
> > returns an error
> > "object required"
> > <%
> > y = Dept.length
> > for i = 0 to y - 1
> >  Response.Write "News release Dept #: "%>
> > <%Response.Write Dept.value(i)
> > next
> > %>

> > Any ideas???

> > K



Sun, 20 Jul 2003 04:26:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Object required error with FSO

2. Object Required Error

3. Getting Object Required error

4. Object required error (posted w/html)

5. Now it's an object required error, you all are awesome

6. Object Required Error

7. Object required error is killing me!!!

8. Object Required Error

9. Object required (Error 424)

10. 424 Object Required Error

11. 424 Object Required error

12. Object Required error

 

 
Powered by phpBB® Forum Software