> Does anyone know how to do this? Any help would be appreciated. If you know
> a way to make my code better that would be great too, I'm quite new to this
You can probably use the form plugin to simplify things quite a bit.
Something along the lines of this:
<form name="<?=$counter?>" class="shipping"
action="updateshipping.php" method="post">
<input name="ship<?=$counter?>" type="checkbox" />
<input name="id<?=$counter?>" type="hidden" value="<?=$payment->id?>" />
<input name="counter" type="hidden" value="<?=$counter?>" /><br />
<input type="submit" class="form" />
</form>
$('form.shipping').ajaxForm({
beforeSubmit: function(arr, jq, opts) {
var counter = jq[0].name; // form name
// is checkbox checked?
var checked = false;
for (var i=0; i < arr.length; i++)
checked |= arr[i]['ship'+counter] == 'on'
if (!checked)
return false; // abort the submit
}
});
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/