Lesson Code: http://www.developphp.com/video/JavaScript/Real-Time-Text-Input-or-Textarea-Filter-Tutorial
In this Javascript programming lesson you can learn Real-Time Filtering of Text Input. You can learn how to program real time strict text fields that will strip or replace unwanted characters from the field as the user types. Using the search or replace String object methods in Javascript along with the RegExp object gives us a wide of logic possibilities in our Javascript pattern matching with regular expressions.
Original source
40 responses to “Real Time Text Input Filter tutorial Program Textarea Javascript HTML Tutorial”
Thank you very much. This video was of great help to me.
hey man thanks for the video , I was having a problem updating a textarea in real time. I see you used value and I tried it and it worked. I was using textContent , I don't know why textContent don't update in real time but in OPERA browser value updates in real time on a mouse event. I'm making a text replacement program. example fb = facebook
Thank you!
Hey Adam, It worked perfectly. Very nice tutorial the only thing that's missing, is prevent users input in copy paste too.. I've tried the same with onpaste() event handler but without success. Regarding any help thanks
Thanks Adam, i write a resume:
<script type="text/javascript">
function filtrarTextoInput(textfield) {
var regex = /[^a-z0-9]/gi;
if (textfield.value.search(regex) > -1) {
textfield.value = textfield.value.replace(regex, "");
}
}
</script>
<textarea id="myID" name="myID" onkeyup="filtrarTextoInput(this)" onkeydown="filtrarTextoInput(this)" > </textarea>
Can anyone tell me how I can make a text box and that is ment to be a like contact form that i can see what they typed in the box?? Would help me alot!!!
Great tutorial! I got a question though. If you are replacing single characters, like for example you press "x" and "z" appears, "x" will still show up for an instance before it's replaced. How to avoid that? I'm on a project simulating a non-ASCII input method using javascript.. Thanks.
a bit late to this tutorial but if I'm allowed a little add, I want to say that if we want to allow some specila characters (like dash or underscore), we have to use backslashes into the argument (- or _), just like the new line (n). I hope Adam won't mind about this comment, some guys (like me) might be wondering about it.
nice video as usual Adam way to go, a very useful way to check but why this not completly work with input type="text" arrow cursor not getting back
hi i want to add something in textarea
Nice fudging video man lol
You're the man Adam!
I tried the same thing for < iframe> instead of < textarea> and it's not working. Can anyone explain why?
Great explanation! I kinda confuse with all of the built-in method, but yeah… everything is difficult before it's easy 😀 (A quote) hahha
Hi, Adam! You are a true hero!
It's Dreamweaver
can anyone tell me what text editor he's using… thanks 🙂
hey flashbuilding how can i create a searchbar that connects to a database such as phpmyadmin and can be customized in the appearence in the form and the searchresults page thanks
-flawless
I like you teaching style. Very clear, informative and a bit funny. Good Stuff!
Hi….I have a quick question on one of your older tutorials, from your website and here. I tried to write you a message, and not able to send it. I have to be a 'buddy.' With that said, I found your most recent, and hope you don't mind me asking here. I wanted to know, from learning your flash cms….how to incorporate the flash site with it….or any site with it. You teach how to make the flash cms, and then a site. But how you put them together. Thanks! 🙂
excellent as always
could maybe show us how to make a random num generator that dusnt repeat numbers?
they're still at it?? for the life of me i cannot understand how anyone can give you crap. F'em.
Glad you find it useful partner… I am using it on my new community site that I am dabbling with.
no problem thanks for the feedback
right on
🙂
NO YOU ARE AWESOME!!!!
Thanks for tuning into the videos. Adobe Dreamweaver is the editor I am using in this video. But since we do not enter "design mode" at all in the video and are doing nothing but straight code… any editor will do… even notepad++ or simple notepad. Dreamweaver has nice formatting, code completion and syntax highlighting huh? That is why I use it.
You're welcome partner
Hey a positive comment… thanks but my brains are mud. I have to write everything down so I don't forget it. My other subscribers are pissing me off so thanks for saying something kind and encouraging.
Hey Adam, is there any way you can export all of your web and graphic design knowledge into a backup file so I can import it into my brain?
Just…. great!!!
Its Adobe Dreamweaver. (I'm pretty sure)
Hi there, I`m your new fan! can you tell me what the editor you r using in your video?
Dear Mr. Adam "Sugar" Khoury Sir, Thank you for showing the path of Illumination, and I seriously miss all your hate literature and abuses on Facebook, Please come back!! 😀
You ARE AWESOME!!!
We miss you too Adam 🙂
To accept line breaks also … [^a-z 0-9?!.,n] … cuz "n" represents new lines
This is great! I never even thought about a real time text filter. Thanks for the video!
Great tutorial. Your videos are really starting to unlock the power of programming to me (even though I still think in a designer's mindset – not a programmers). But I am slowly starting to wish I would hand code every single one of my projects! Thumbs up.