Gen_Validator Help, Please.
I am developing an understanding of pre-written JS and plugins, but a long way from originating or extensively modifying code. I am currently using a gen_validator from http://Javacript-Coder.com, which allows for the addition of custom function entries. I would like to add two functions which may be simple to most, but hair-pulling for me at this point:
Function 1. Validate file extensions and limit them to JPG, JPEG, GIF, PNG.
Function 2. Validate file size and prevent files exceeding 1MG from being uploaded.
I have 10 separate upload boxes within the form, and would like to ensure that each upload input box is validated with the above stated preferences.
There are currently several functions that already exist within the script, and if an entry is not valid of course, a pop up box of error messages will occur upon clicking submit. I simply would like to add the two functions above and ensure the error messages regarding the files, if any, are integrated within that same box.
I have posted the existing validating code below, as well as a link to the actual form. Thanks in advance for any assistance.
<!-- Form Validation Script Starts Below -->
var frmvalidator = new Validator("hb2_form");
//frmvalidator.EnableOnPageErrorDisplaySingleBox(); - On page Error Validation pt1. - currenlty disabled
frmvalidator.EnableMsgsTogether(); //- On page Error Validation pt2. - currently enabled
frmvalidator.addValidation("contact_name", "req", "Please enter your Name - Required.");
frmvalidator.addValidation("phone1", "req", "Phone Number - Required.");
frmvalidator.addValidation("email", "req", "Email Address - Required.");
frmvalidator.addValidation("first_file", "req", "Upload at least one image file - Required.")
//frmvalidator.setAddnlValidationFunction("VerifyEmail")// Verifies email entry.
<!-- Form Validation Script Concludes -->
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread