Portal Home > Knowledgebase > Articles Database > validate name field in contact for


validate name field in contact for




Posted by wiredhosting, 11-22-2008, 02:58 PM
validate name field in contact for Hi to everybody! we have our contact form redesigned by a coder, he is not available right now so we need your help on this slight issue.. the contact form works perfeclty. it validates every filed.. the problem is that the "name" field does not accept any blank space, so if you enter your first name its okey, but if you try to enter name + surname it gives error as if the name was wrong.. can someone help us with that? here is the validation code.. Code: function isAlphanumeric(elem, helperMsg){ var alphaExp = /^[0-9a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphabet(elem, helperMsg){ var alphaExp = /^[a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } __________________Hosting

Posted by SysAdminMan, 11-22-2008, 06:39 PM
You could try adding - \s after the uppercase Z on each of the lines starting "var" __________________sysadminman Server Administration - http://sysadminman.netUK based VOIP virtual servers

Posted by wiredhosting, 11-22-2008, 06:54 PM
Better impossible Bucasia do you do web design ? (CSS / XHTML). Thanks __________________Hosting

Posted by SysAdminMan, 11-22-2008, 06:59 PM
I'm not really sure if "better impossible" means it fixed it or not! :-) No, coding's not my thing. I struggle to do my own stuff but that's about it! __________________sysadminman Server Administration - http://sysadminman.netUK based VOIP virtual servers

Posted by Barti1987, 11-22-2008, 08:48 PM
Create a new function with the expression: var alphaExp = /^[a-zA-Z ]+$/; It should cover spaces. Peace, __________________NEW: What Is Their IP - Anyone's IP a click away. URL Tracker, Shortener, Blocker, Unblocker, Whois and More.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
ssl nightmare (Views: 686)