Contact Form: Captcha, JavaScript and PHP Validation

Found this site and have been modifying the code for my project. I chose it because it incorporated both client and server-side validation, having said in my learning proposal that I would like to incorporate both client-  and server-side technologies (what was I thinking???).

I went with one from here and added a new field because I like to keep first name and last name separate.  That was easy enough in HTML, and I managed to get most of the validation scripting to pick it up but must have missed at least one little thing (I don’t know what–yet) that kept making it throw an error.  In this case (an email signup) it probaby doesn’t matter if you have just one name field rather than first name and last name. Some web pages only ask for an email in their newsletter signup form. Anyway, there was no alpha validation for the name field, so I added one, allowing only letters and spaces to be added–I have to look further to find code that allows punctuation marks, or people with hyphenated-names will have to omit the hyphen for the purposes of my form.

I chose a form with a captcha code, as my Week 7 Guestbook keeps getting spammed and I wanted to avert that. I was talking to Vince about captcha codes, and he suggested a field asking a question that had to be answered by a human, rather than using a captcha code. I think we both agreed captchas are a bit unappealing, but I thought the one included with the form I chose was better than some I’ve seen. This form  incorporates a ‘human’ question and requests a phone number (that could be handy), but I was put off by the number of problems posted below. That said, I might just try it….

By the way, if you want to create your own captcha code, this site tells you how. So…

This site is has some great JavaScript tutorials relating to creating and validating forms, among other things.

Julie

References

A simple, easy PHP contact form 2012, viewed 11 May 2012, <http://www.html-form-guide.com/contact-form/creating-a-contact-form.html>

Creating a contact form for your website viewed 16 May 2012, 2012, <http://www.html-form-guide.com/contact-form/creating-a-contact-form.html>.

Javascript-Coder.com — Javascript tutorials and articles 2012, viewed 15 May 2012, <http://www.javascript-coder.com/>

‘Make PHP CAPTCHA more secure ‘, 2012, viewed 11 May 2012, Superior Web Solutions, <http://www.superiorwebsys.com/blog/92/Make_PHP_CAPTCHA_more_secure/>

PHP Contact Form Tutorial 2012, viewed 15 May 2012, , <http://www.html-form-guide.com/contact-form/php-contact-form-tutorial.html>.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: