I’m not a script writer so I’m a bit handicapped when it comes to getting this stuff to work, but basically I have an existing validation script for a registration form that I am attempting to add an input to with a validation for a specific year range (1946-1964). Currently if you do not correctly enter the form questions a dialog box pops up with a message indicating you didn’t fill in the field correctly.
<script type="text/javascript">
function validateregform()
{
with (document.getElementById('frontregisterform'))
{
if (validate_required(document.getElementById('regname'),"Please fill in your full name!")==false)
{document.getElementById('regname').focus();return false;}
if (validate_email(document.getElementById('regemail'),"Please fill in a valid email address")==false)
{document.getElementById('regemail').focus();return false;}
if (validate_required(document.getElementById('pass'),"Please fill in your password")==false)
{document.getElementById('pass').focus();return false;}
}
}
</script>
So what I need this to do is check the field entry to make sure it is within the year range of 1946 to 1964 and then if it is not to simply pop up a message saying (registration is restricted to those born between 1946 to 1964).
This doesn’t need to be a sever level thing as I do not need to prevent individuals from actually registering if they are not born within that year range, other validation will be required later in the process that will prevent their use. Just at this point I need to alert registrants that the site is intended for use by a specific age group.
Any assistance in this matter would be greatly appreciated.
This can help you ?
[Edit] : Don’t forget to return false so that the form is not sent
Don’t forget to accept answer or ask for more information.
Nicolas.