troubleshooting Question

Very basic HTML checkbox problem

Avatar of pcalabria
pcalabriaFlag for United States of America asked on
JavaScriptHTML
4 Comments1 Solution217 ViewsLast Modified:
Hello Experts, thanks in advance.
I've new to Javascript and just can't figure this out!

I have an Order Form that consists of a variable number of rows.

The customer simply checks a checkbox to select which items he wants.

The problem I am having is that if a checkbox is not checked, then no value is returned.

Here's some sample code.  While the code below only includes two line items, the actual number may vary from 1 to any number of rows.

mypage.asp must have code to extract the part number and qty for each item selected.

If there's a way for a checkbox to return not checked this job would be easy.

My code on the mypage.asp loops through the querystring collection, but returns an error when a value of checkbox that is not checked is encountered.

''''Code Below"""
<form action="mypage.asp" method="get">

Qty<input name="Qty" type="text" />
Part Number<input name="PartNumber" type="text" />
<input type="checkbox" name="buyme" value="yes" /><br /><br />

Qty<input name="Qty" type="text" />
Part Number<input name="PartNumber" type="text" />
<input type="checkbox" name="buyme" value="yes" /><br /><br />

<input name="Update" type="submit" />
</form>
ASKER CERTIFIED SOLUTION
pcalabria
Founder and CEO

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 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 4 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