Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want a user to use a textbox upto a limit and after that text box should get disabled,
for eg. If a user wants to enter information of only 3 customers then that textbox should get disabled after entering 3 values
Posted
Comments
Arasappan 17-Jan-16 23:24pm    
how many textbox u have

This is not exactly right. If you are going to provide free text entry in the nox, there is no way to accurately detect how many customers were entered in the box.

If these customers are to be selected from a database, provide a list view rather than a drop down so that user can select customers directly.

Alternately, just provide three text boxes with maxlength[^] defined on each so that user enters names with restricted length.
 
Share this answer
 
Hello abhinav, Thanks for your reply . But please understand my question . I am designing a flight management project , In that when my user selects no.of passengers of his choice. Then he should be only allowed to enter information of 3 customers if selects no.of passengers as 3. Language :-C#
 
Share this answer
 
Comments
You should add a comment inside the answer. But you added another answer. Please delete this and add a comment inside the answer.
Do you want to allow user to enter customer details in the text box with any separator?
If yes then use below code to disable text box.

$(document).ready(
function(){
	$('#userInput').bind('input', function(){
   var users = $("#userInput").val();
   var usersList = users.split(';');
   //disable if users count is > 3
   if(usersList.length > 3){
   $('#userInput').prop('disabled','disabled')
   }
});

}
)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900