Hello, curently I am trying to figure out this script: [url]http://javascript.internet.com/forms/val-no-alert.html
And the part of the script that I am having trouble with is the one below (I modified it a bit from the original code to suit my preferences).
[code=php](f.paragraph.value.length < 50)
The 50 is the minimum amount of characters that must be entered into the form before submission. But I don’t want it to count characters. Instead, I would like it to count the number of words. I have tried copying and altering the e-mail validation code so instead of detecting a “@”, it would detect a certain number of ” “, like so:
[code=php](f.paragraph.value.search(” “) <= 50 || f.paragraph.value.search(“[.*]”) <= 50) // validate word count
I guess the space made it undefined, because it didn’t work (the error message would still be there and the form wouldn’t send). I’ve tried using [b]
I could not find any solutions here in the forums, either. I’m getting tired of looking for scripts and trying out different kinds of commands, so I am looking to the people of this forum as a last resort. Would please you help me? I would be very greatful. If it is too confusing, then I can try to explain it a bit more. If it’s impossible to code, then I’ll just let it be.
Anyways, thank you for taking time to read all of this ?