chris h - 2011-07-18

Hi, i know i should have 2 fields for a first and last name in my form but i dont - and was wondering if someone would be able to help me with - or has - a java script valadation rule to only allow a one letter character (letter in between spaces such as a middle initial) in a text field if at least 2 words are also included (2 words of at least 2 or more characters)

so if the user input ' John H ' an error prompt would display until one more word is added/at least 2 words are found

right now im using the below coding to allow at least 2 words in the text field but would like to see if its possible to enhance it so it will only block a one letter word if there are less than 2 other words in the form - right now if any words is added with less than 2 characters it will display an error… if anyone knows of a better form of code that needs a minimum of 2 words added and still allows single characters such as middle initials to in a validation script i'd greatly appreciate your help… i get lost on validation process'

'cheers' in advance to anyone that may know of something or a site that can point me in a better direction

function(value,element){return this.optional(element)||/^((\b{2,80}\b)\s*){2,}/