The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

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.

Check this form validation script

Hey everyone

I've had this script in various stages of completion for the last year or so. I've finally put it all together and added documentation and a working demo. Feel free to use it, (just humbly give me credit )

Note: If by chance you have aleady used a previous version (1.01, 1.11, 1.42) and you want to start using this version, please re-read the documentation, because some of the rules have changed and your page(s) will need updating.

1. Allows me to check that an "Accept Terms & Conditions" clause in a form is ticked. With it, users must explicitly signal their acceptance of the terms/conditions (by checking a box), before he/she can submit the form.

2. Allows me to make sure an important field within the form is filled out correctly, by requiring that the user fills it out twice.

PLEASE!! If you are going to use my validation script, read the documentation! It took me quite some time to put it together, and I didn't do that so everyone could ask questions that are covered by it.
</rant>

ok, gosh, calm down. this one thing I hate about some people and especially academics. 'Everything is covered in the docs' people.. students get afraid to ask them after some time 'cos they get ****ty responses like this. Fair enough if it's in your documentation, but it's not exactly a small document and I may have missed it.

You should never try to interpret feelings from written text. It just can't be done, so don't bother trying.

Emoticons help, so pay attention to those, like the at the end of my rant SHOULD have let you know that I was indeed calm and ok with your question.

Seriously, I was a bit surprised by your question, becuase you can very plainly see just from looking at the demo page that my script would accomodate your need. I would just appreciate it if you were somewhat familiar with it's capabilities before asking questions without regard

Cheers

P.S. For the record, you may contact me with any questions, and I promise I won't get mad

1. Today (3 August 2002), I downloaded your latest revision of the validate.js file. I implemented the 'equalto' on a couple of fields and it seemed to work. Then, however, when I try to submit a form that has some errors remaining, I get a message popping up saying 'fnselect' a few times, then the actual message that should be displayed: i.e. "you have not entered your name".

2. I have noticed in your example that at the end of some lines (in the code) you have "... / >"
What exactly is the ending forward-slash and space for?

I also noticed that when validitation messages are displayed, for example:

"Please enter the ..."

In the '...' part the name of the field is displayed. However, what if you want to display a more meaningful message. Eg. the field is "More about yourself", for example, but the name of the field is: name="about".

So, instead of displaying "Please enter the about", it would say something like "Please enter more about yourself".

#1 - Ya, looks like you got a rogue alert. Just find it and delete it. I work on it sometimes while it's live (maybe not the best idea )

#2 - the addition ' />' at the end of standalone tags (e.g. don't require separate closing tags) is actually the new standard for XHTML, and is perfectly valid for regular HTML. I'm just trying to get used to typing it (and <br /> and <hr /> and <meta /> etc)

#3 - Ok, I believe that there are some typos in the documentation (like you said earlier, it's long) But, good news, I'm setting up and HTML API for it (sneak peek here) so hopefully these documentation nigglies will be taken care of

Well, about the error messages. You can change up the script how you want. Perhaps store the error message for the object in the 'label' attribute or something like that. lemme know!