html5 input pattern for some characters

Dear Experts,

How can I prevent my users entering ç,ı,Ş,ş,Ç these characters into my text box?
what pattern should I use?
I'm using html5

<input type="text" name="test" id="test">
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Are you referring to using the input pattern attribute or do you want to actually prevent those char's from even displaying - i.e. use a JavaScript keydown function to cancel the event if it is one of those characters?
BRMarketingAuthor Commented:
Dear Julian,
JavaScript keydown function would be great? how can I do that?
how can I my users do not enter Ç,ş,ğ characters?
BRMarketingAuthor Commented:
can I also use html input pattern regex for preventing this?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

BRMarketingAuthor Commented:
I can also use a php replace function to change the characters...
what do you suggest I should do?
Julian HansenCommented:
can I also use html input pattern regex for preventing this
No, the support cross browser varies and for the most part it just highlights the error - it does not prevent the entry of the characters.

What you want to do is intercept the entry of the character and prevent it even showing.

This is fairly straight forward for characters typed in but what about cut and paste - how do you want that handled.

Two options
1. Any change to the input you remove unwanted characters - this might end up with bad data anyway because you will be removing the option for the user to correct and assume that what they wanted was the word without the invalid characters
2. Don't worry about replacing - rather just highlight the input as being invalid and prevent submission until the user fixes the problem.

You will still need to validate on the PHP side as nothing from the browser can be trusted anyway - client side validation does not negate the need for server side validation - the latter is ALWAYS needed - the former - implement for convenience as required.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BRMarketingAuthor Commented:
Thank you Julian
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.