hi i have a form ...i want to validate the fields in such a way it does not accept if the user is trying to enter numeric instead of characters..........
eg in a name field if the user is trying to enter number....the typed data should not come...it should act like readonly field..........
kings -7 Junior Poster
Recommended Answers
Jump to Post— MitkOK 61Hi.
I use this function to validate name in my forms :
function valName($name) { $name = preg_replace(‘/[\s]+/is’, ‘ ‘, $name); $name = trim($name); return preg_match(‘/^[a-z\s]+$/i’, $name); }
Jump to Post— OmniX 21I use javascript for any form validation that I require and resuse where required.
Javascript: // Validates Numbers 0-9 0=48 function Numbers(e) { var cc = (e.which) ? e.which : event.keyCode; if (cc > 47 && cc < 58) { return true; } return false; } Field: …
All 8 Replies
MitkOK 61 Junior Poster
OmniX 21 Practically a Master Poster
kings -7 Junior Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster
OmniX 21 Practically a Master Poster
OmniX 21 Practically a Master Poster
hooray 1 Junior Poster in Training
OmniX 21 Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.