Hello Shawn,

Saturday, July 10, 2004, 4:46:10 AM, you wrote:

SKH> 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?

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

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

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

SKH> Regards,

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

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

Thanks, that solve my problem! Thank you .. :D



-- 
Best regards,
 Susetio                            mailto:[EMAIL PROTECTED]




------------------------ 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