Hello All.
I need a sample of a form that validates dymnically created form fields.
Specifically checkboxes and text fields all in one form.
On the form a user chooses a product by selecting a checkbox. I have the syntax
for this and it is working propery. I need to add another function to make sure
the users enters a quantity.
Here is my script:
<script language="javascript">
function checkForm() {
var el = document.forms[0].elements;
for(var i = 0 ; i < el.length ; ++i) {
if(el[i].type == "checkbox") {
var checkboxgroup = el[el[i].name];
var itemchecked = false;
for(var j = 0 ; j < checkboxgroup.length ; ++j) {
if(checkboxgroup[j].checked) {
itemchecked = true;
break;
}
}
if(!itemchecked) {
alert("Please select a product");
if(el[i].focus)
el[i].focus();
return false;
}
}
}
return true;
}
}
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316813
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4