Forum Moderators: open
I could use some help. I have a form where I'm having people enter URL's into textboxes that should not contain URL's.
How can I write a form validation script where I can check that each textbox field does NOT have a URL in it?
For example, the phone number textbox field should only accept a valid phone number (###) ###-####. The name textbox field should only contain letters (no numbers or characters).
Can someone help me write something?
Thank you.
I have a form where I'm having people enter URL's into textboxes that should not contain URL's.
By this do you mean you're getting link spam, like
Name: [a href="http://spamsite.com"]
Email: [link="http://spamsite.com"]
If this is the case, Javascript won't help you as this data is posted directly to the form processor, bypassing the form. What you want to do is cleanse user input and filter it within your form processor.
Multiple threads on form abuse [google.com]
If this is the case, Javascript won't help you
The server-side processor is where you cleanse/filter these, see some of the threads in the previous link. It depends on your server-side language. These types of automated submissions don't even "visit" the form page, they post directly to your form processing script.