Hi Folks,

I have 2 texboxes with the name names like 'des0' and 'des1', So i need to validate this two controls for required filed with the help of loop. something like this

for (var i=0;i<=1;i++)
{

}

So i have confused what will write inside the loop for validate the controls. So please help me writing the things

Recommended Answers

All 3 Replies

first decide against what (format ) you want to validate with them, like all numbers or all chars or no special chars etc.
If thats the case, better to this in javascript.

i need required field validation.. any way i got one way to do that.. here is the javascript for that.. with this code i can customize with my requirement.

function valid()
{
var inputs = document.getElementsByTagName('input');

for(var k=0;k<inputs.length;k++)
{
var input = inputs[k]
//if(input.type!= 'text'){ continue };
if(input.value == '')
{
alert("Enter All Fields");
return (false);
}
}
}

This will work for the required filed validatons..

ok, that seem to be perfect.
have a happy time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.