
I have two pairs of textboxes...( so in total 4)...if both the pairs are empty, the values in the corresponding textboxes should not go to the database...otherwise if either or both are filled, they can go to the database.

<html>
<script>
function validate(){
var v1=document.form.text1.value;
var v2=document.form.text2.value;
var v3=document.form.text3.value;
var v4=document.form.text4.value;
if(v1==""){
alert("Enter text1 value!");
return false;
}
if(v2==""){
alert("Enter text2 value!");
return false;
}
if(v3==""){
alert("Enter text3 value!");
return false;
}
if(v4==""){
alert("Enter text4 value!");
return false;
}
return true;
}
</script>
<form name="form" method="post" onsubmit="return validate();">
<input type="text" name="text1"><br>
<input type="text" name="text2"><br>
<input type="text" name="text3"><br>
<input type="text" name="text4"><br>
<input type="submit" value="submit">
</form>
</html>

Thnx for the solution...but I want a different solution. Let me explain the case w.r.t your answer. v1,v2 are pair 1 and v3,v4 are pair 2.I need to give an error prompt if none of them are filled. If v1,v2 are filled or v3,v4 are filled or all the fields are filled, it should go to database. I think I was not clear in my question. So, v1 and v2 are considered as one and similarly v3 and v4 are considered as one.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.