Checkbox group

N

Ngan Bui

I have a editclient asp file. It allows the user to
update the client info like address and other information.

One field I have in the sql table is DisabilityCode. A
person can be Vision, Physical, Conitive...They are coded
by the first initials. So for one client, they can have
up to 5 codes....for example, they could be CPV, PV or
just V.

How should I go about setting up a field on the webpage to
allow the customer service rep to choose what code applies
to the client?

I was thinking of doing a checkbox group...so the client
just checks the boxes that apply. When saving to the sql
table, asp automatically saves it as "C, P, V" or "C, P".
For this: When a CSR goes to edit a client info, if the
text field has "C, P", how can I have the C and P checkbox
already checked for them?

Another option would have each code be its own checkbox.
I would still have to do an if then statement for each
checkbox to have it checked or not when the CSR goes to
that webpage.

Any help is appreciated.

Thanks!
Ngan
 
J

Jim Buyens

-----Original Message-----
I have a editclient asp file. It allows the user to
update the client info like address and other information.

One field I have in the sql table is DisabilityCode. A
person can be Vision, Physical, Conitive...They are coded
by the first initials. So for one client, they can have
up to 5 codes....for example, they could be CPV, PV or
just V.

How should I go about setting up a field on the webpage
to allow the customer service rep to choose what code
applies to the client?

I was thinking of doing a checkbox group...so the client
just checks the boxes that apply. When saving to the sql
table, asp automatically saves it as "C, P, V" or "C, P".
For this: When a CSR goes to edit a client info, if the
text field has "C, P", how can I have the C and P
checkbox already checked for them?

Eeew, ugly! Don't do that. You're constantly going to be
writing code like:

if instr(ucase("" & rs("DisabilityCode")) = "C") > 0 then
' ...
end if

and writing a SQL statement that selects all the records
with, say, disability code C is going to be even worse.
Another option would have each code be its own checkbox.
I would still have to do an if then statement for each
checkbox to have it checked or not when the CSR goes to
that webpage.

Ah, tranquility. Be at peace. Use this approach.

Set up a separate database field for each code, and when
you display the form, test that field when deciding
whether or not to emit the text "selected".

(BTW, I greatly dislike letter codes. A numeric 1 or 0 (or
a boolean true/false) is much easier to get right than a
value of "C" (or is it "c") vs. a space, or a null, or a "-
", or whatever.)

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
N

Ngan Bui

Thanks for your reply. A question about your suggestion.

If I make each code be a yes/no field (1 or 0), wouldn't I
still have to do the following for each of the code when I
want to display the results:
If rsClient("fieldname")=1 Then
<input box CHECKED>
else
<input box...>
end if

Is this the only way html can understand yes/no fields?

Maybe I can create a javascript to do the testing so I
don't have to do the If then for each code? Like an
onfocus function.

Thanks!
Ngan
 
J

Jim Buyens

Yes. Acutally, the more common form is:

<input type="checkbox" name="fieldname" value="1"
<%if rsClient("fieldname")=1 Then Response.Write " checked"%>>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top