Handling dynamic checkbox input

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Handling dynamic checkbox input

Post by TonsOfFun »

I am having trouble handling checkboxes with my form.

The user uploads up to 10 images. Then when that form is submitted, they can delete the picture, add a title, and select whether or not to add it to the home page (which is the checkbox).
My problem is that I can't figure out how to associate the image with the specific checkbox since the checkbox only returns values that are selected. At least as far as I can figure out.

Code: Select all

<input id="name' . $i . '" type="text" name="name[' . $i . ']" value="Photo Title*" onfocus="clearText(this)" onblur="clearText(this)" />
<input type="checkbox" name="home[]" value="' . $i . '" />
<input type="hidden" name="photo[' . $i . ']" value="' . $photos['name'] . '">
<input type="hidden" name="submitted" value="TRUE">
Can I use javascript to set the value of the check box to the value of a text field?
Post Reply