javascript thread: Checking a checkbox using Javascript if criteria pulled from SQLServer database meets specified conditions
You should use asp.net, and this would be trivial.
in your html part, you have checkboxes, e.g.
<asp:checkbox id=box1 runat=server>...
and in your Page_Load() function in script part:
Page_Load() {
if(condition meets) {
box1.Checked = true;
}
}
hope this helps.
-----Original Message-----
From: Dean [mailto:spinout@i...]
Sent: Wednesday, January 30, 2002 6:05 AM
To: javascript
Subject: [javascript] Checking a checkbox using Javascript if criteria
pulled from SQLServer database meets specified conditions
Hi There
I am trying to write a Javascript that will check a checkbox if certain
conditions are met. These conditions will be pulled from an SQL server
database using ASP/SQL.
Background:
I am writing a login page. Each user will have access to certain areas.
For example:
- Change Web Site Poll
- Change Web Site Forum
- Change Web Site News
etc.
If I want to modify a users account and give them more access to other
areas they previously do not have access to I want to be able to bring up
their details on a page and have Javascript already tick the checkboxes
for the areas stored in the database which they are already granted access
to.
For example: If I create a login 'billgates' and he has access to change
the web site poll but not the web site forum or web site news, I want the
page to load and tick the checkbox for the web site poll, but not the web
site forum or web site news.
I hope that isn't a little too confusing. I have tried to explain it as
simply and clearly as possible.
Any help would be greatly appreciated. Thanks!