Hi Susetio,

> I need to count array, and that array came from
> checkbox, like :
>   myarray = Request.Form("CheckMark")
>   response.write ubound(myarray)
> But i get error message :
>   Microsoft VBScript runtime error '800a000d'
>   Type mismatch: 'UBound'
>
> what is wrong wtih that code?

When you perform a simple assignment in VBScript it assumes the
content is what is being passed - and in this case it'll be converted
to either a string-based variant or an integer- or long-based variant,
depending on what value you have in the CheckMark object. To
EXPLICITLY convert your form element to an array you would use:
  myarray = Array(Request.Form("CheckMark"))
  response.write ubound(myarray)

Of course, this will result in your array being a single element. If
your CheckMark object is *really* an array of client-side controls you
could use the following to puch them into an array of the same length
(depending on how many were returned to the server, of course):
  myarray = Split(Request.Form("CheckMark"), ",")
  response.write ubound(myarray)

In this method you may want to Trim() each element before you attempt
to play with it since sometimes the elements will have a preceding " "
attached to them. Also, be careful not to include a comma within the
value of any of the tags or it would be split when returned to the
server.
  myarray = Split(Request.Form("CheckMark"), ",")
  for liter = lbound(myarray) to ubound(myarray)
    response.write "<p>Array Element #" & liter & ": "
    response.write myarray(liter) & "</p>"
  next

Regards,

Shawn K. Hall
http://ReliableAnswers.com/

'// ========================================================
    When she opens her mouth, it seems that this is only to
    change whichever foot was previously in there.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to