hi guys,im new to this forum
could anyone help me to solve this problem for me..
In my site im generating multiple text boxes and i need to wirte validations for that....
could anyone help me to solve this problem for me..
In my site im generating multiple text boxes and i need to wirte validations for that....
Code:
<form id="form1" name="form1" method="post" action=""> <input name="cc1" type="text" id="cc1" value="0" /> <br /> <input name="cc2" type="text" id="cc2" value="0" /> <br /> <input name="cc3" type="text" id="cc3" value="0" /> <br /> <input name="cc4" type="text" id="cc4" value="0" /> <br /> <input name="" type="submit" onclick="return valid()" /> </form>
Code:
function emptyvalid(elem,altxt){
var txt = document.getElementById(elem).value;
if(txt == ""){
alert(altxt);
return false;
}
return true;
}
function valid(){
for(i=1;i<10;i++){
if(emptyvalid("cc"+i,"not empty")==false){
return false;
}
}
}
Comment