If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Also the issue I was having was getting JavaScript to validate that a user entered a valid email address. Not sure if that is posible with Jquery..

Both jQuery and Prototype are both written in JavaScript and so there is nothing that is possible with one that is impossible with the other - for the one line of code necessary to validate an email address neither library is relevant.

It all depends on just how strictly you want to validate the email addresses. Most email validations that people use are not very accurate and disallow a range of rare but allowable addresses. A simple regular expression will do the validation for you - anything from just checking that the value contains an @ character with not more than 256 characters before and not more than 64 characters after through to the following expression which will accept any valid email address and reject any invalid one (of course just because an address is valid doesn't mean it exists) - note the following should be all on one line and assumes you have extracted the address to be tested into a variable called email and will be using a variable called message for displaying any error messages:

Of course using that validation in JavaScript would be overkill since you have to validate everything again on the server anyway and JavaScript validation is only there to highlight common errors sooner so that those visitors with JavaScript enabled can fix their errors before they submit the form - so a simpler test in JavaScript and then applying the full test on the server would be more appropriate.

You have three components here: the HTML/CSS for the form mark-up and layout, the PHP/MySQL for the server side processing of the form input, and the JavaScript for the client-side validation and dynamic functionality based on that. Now, to JavaScript (or any framework written in JS, like prototype or jQuery) it doesn’t matter at all what your PHP script looks like. Ideally, you should be able to use that form and the PHP script you’ve got without any JS at all. That means you can switch the JS for the validation at your will.

So, you can use the jQuery form plugin to send the data and display a thank you message but you’ll have to add the e-mail validation yourself. I’ve used something like this for a newsletter form in the past:

I guess you can use your PHP file with this form, too. All you need to do is change the input field name attributes to the ones you have and change the path to the plugin in the $.getScript() function according to your set-up. There is a simple e-mail validation in place as you might see in the emailAddr variable. However, you have to take care of server-side validation, too. Head over to the PHP forum and ask those guys for that.

I hope that helps but I don’t have the time to guide you through step by step.