Link to home
Start Free TrialLog in
Avatar of deepPowdah
deepPowdahFlag for United States of America

asked on

VBScript Server Side Code to read checkbox.ID

I generate a dynamic set of checkboxes in Classsic ASP

<input type="checkbox" name="cbx1" id="cbx1" value = "abc" >
<input type="checkbox" name="cbx2" id="cbx2" value = "def" >
<input type="checkbox" name="cbx3" id="cbx3" value = "ghi" >

When the ASP Page is posted, I need to loop thru the checkboxes and read their ids in VBScript on the server.

For R = 1 to n
   set myCbx = request.form("cbx" & r)
   myID = myCbx.ID
Next

However the system doesn't like the myID = myCbx.ID line.  Is there any way to read the ID of a checkbox if it is not checked?

Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Bobaran98
Bobaran98
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deepPowdah

ASKER

From what I have been able to determine, an unchecked checkbox does not have an ID or value property.  Only checked checkboxes have these properties.  The solution to my problem, as you suggested, was to create a hidden field in which I can put the vaue I need to keep.  I implementend that and it's sweet.  Thanks for your help.