Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want the user to prevent entering very long word without space e.g 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in asp.net textbox. There my be many words in the textbox but not suxh long word because after saving i display that in repeater and its is expanding my repeater becausethe unspaced string can't be wraped
How to do this with jquery. Is it possible to add a space automatically after 30 character in such word?
Posted
Comments
Krunal Rohit 7-Nov-15 3:33am    
You can use textarea instead.
But you can restrict the input using max=30.

-KR

1 solution

I think you should wrap instead of restricting. Refer - Wrapping Long URLs and Text Content with CSS[^]
 
Share this answer
 
Comments
xpertzgurtej 7-Nov-15 4:09am    
Yes that works..But i want to restrict user to enter those useless long words because they worth nothing
Look, you should restrict in any case. You can't read every user's mind and design accordingly. Otherwise, what you can do is to cap the length and mention that near to the textbox like "Maxlength is 50" or something like that. Whatever user enters, he/she is going to see that. So, why to bother... Let them do. You just prepare your controls in such a way that it does not overflow and looks odd.
xpertzgurtej 7-Nov-15 6:51am    
Thanks for you suggestion.If no other solution found then i will go with your solution.
Glad to hear that.
xpertzgurtej 9-Nov-15 0:32am    
finally implemented the solution suggested by you..thanks

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