You should use client side validation for same.
You can check onblur event for the length of a characters inserted into the textbox.
HTML
<input type="text" onblur="return myFunction()">
Script
function myFunction(){
var iCount = $("#txtValue").val();
if(iCount > 6){
return true;
}else{
alert("Your alert message");
return false;
}
}
Or
You can set validation on button click event also instead of blur or textchanged event.
If you are using server side textbox (asp:) then set
AutoPostBack = False