Forum Moderators: open

Message Too Old, No Replies

Form Validation

Check for valid entries

         

hbradshaw

11:12 am on Jun 13, 2009 (gmt 0)

10+ Year Member



Hello:

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.

rocknbil

5:31 am on Jun 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard hbradshaw,

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]

hbradshaw

11:08 am on Jun 18, 2009 (gmt 0)

10+ Year Member



Hi,

Yes, I'm gettting link spam within my forms. I'm new to JavaScript so I don't know how to proceed with your suggestion.

How do I begin?

rocknbil

4:06 pm on Jun 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.