Pages

Search This Blog

Sunday, February 17, 2008

Get value from dynamic (number) radio button using vbscript

Here is my scenario, i have a ratio button but i'm not sure how many radio button will be populated. It can be one or it can be more than one (Array). I've tried many way to make it work but fail. Finally come out with below work around.

On Error Resume Next
radCount = document.all.RadDynamic.length
If err.number <> 0 then
If document.all.RadDynamic.checked Then
strLogoID = strLogoID & "," & document.all.RadDynamic.value
End If
Else
For i=0 To document.all.RadDynamic.length -1
If document.all.RadDynamic(i).checked Then
strLogoID = strLogoID & "," & document.all.RadDynamic(i).value
End if
Next
End If

2 comments:

Unknown said...

I'm glad it worked for you; I also wish you would've posted more of your code, so the rest of us would know what you're talking about.

Anonymous said...

Thanks, worked perfectly for me :-)