troubleshooting Question

Make Checkbox checked based upon array and value

Avatar of DLockwood
DLockwood asked on
JavaScript
7 Comments1 Solution547 ViewsLast Modified:
I have a series of checkboxes with the same name...i.e.

<INPUT TYPE=CHECKBOX NAME='MyChkBox' VALUE='Bread'>
<INPUT TYPE=CHECKBOX NAME='MyChkBox' VALUE='Butter'>
<INPUT TYPE=CHECKBOX NAME='MyChkBox' VALUE='Eggs'>
<INPUT TYPE=CHECKBOX NAME='MyChkBox' VALUE='Milk'>

When the user opens up there order, they need to see what was checked off.
So, if record is (Bread,Eggs,Milk) I am parsing this into an Array...
Array(0) = Bread
Array(1) = Eggs
Array(2) = Milk

How do I show the check boxes as "checked"?

I am sure that I need to look through the checkbox array and check it's value against my array of values, but I do not know the syntax to do it.

Thanks much!

D
ASKER CERTIFIED SOLUTION
Pravin Asar
Principal Systems Engineer
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros