I originally posted this in the VBScript forum, but it seems that it's more ASP than VBScript (according to them).
I have the following cludge of code (direct C&P from my page):
I need to set all my form variables for each "key" to 1 or 0 so I can insert it into a table.
The problem is that my loop only seems to register any checkboxes that are checked (ie, "on"). Those that are unchecked don't register in the loop. For example, my sample data produced the following:
while it *should* have produced the following:
The variables that are missing in the first sample are those that I had unchecked.
Any idea how I can get it to return *all* the pieces of information in the form, checked or unchecked? So far the only solution that's been offered is setting all the variables to 0 in the first place, then running the loop, resetting those that pop up to 1. But that seems rather silly to me.
I have the following cludge of code (direct C&P from my page):
Code:
for each key in Request.Form
if Request(key) = "on" then
key = 1
else
key = 0
end if
next
I need to set all my form variables for each "key" to 1 or 0 so I can insert it into a table.
The problem is that my loop only seems to register any checkboxes that are checked (ie, "on"). Those that are unchecked don't register in the loop. For example, my sample data produced the following:
Code:
ClientSurveyInvite: 1
UserAdmin: 1
FinancialReporting: 1
Timesheets: 1
Sysadmin: 1
while it *should* have produced the following:
Code:
SearchWarrant: 0
FileReview: 0
OnlineRequestForms: 0
Dashboard: 0
Timesheetmgmt: 0
Timesheets: 1
ClientSurveyInvite: 1
UserAdmin: 1
FinancialReporting: 1
Sysadmin: 1
The variables that are missing in the first sample are those that I had unchecked.
Any idea how I can get it to return *all* the pieces of information in the form, checked or unchecked? So far the only solution that's been offered is setting all the variables to 0 in the first place, then running the loop, resetting those that pop up to 1. But that seems rather silly to me.