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....
Expand|Select|Wrap|Line Numbers
- <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>
Expand|Select|Wrap|Line Numbers
- 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;
- }
- }
- }