I have the following code (which used to work, but the page has since changed):
The form name is "frm" and I've tried every variation possible to try and define "crap" but it just doesn't work (like including value at the end, etc.). The function is being called in an onSubmit, like this:
):
Ryan ;-]
Code:
function validation_function2() {
crap = document.frm.upFile;
arr = crap.split(".");
reg = /^((pdf)|(PDF)|(gif)|(GIF)|(htm)|(HTM)|(html)|(HTML)|(jpeg)|(JPEG)|(jpg)|(JPG)|(mdb)|(MDB)|(xls)|(XLS)|(ppt)|(PPT)|(doc)|(DOC)|(txt)|(TXT))$/;
if(reg.test(arr[arr.length - 1]))
{
}
else
{
alert("You can only upload Adobe PDF, GIF, HTML, JPEG, Microsoft Access, Microsoft Excel, Microsoft PowerPoint, Microsoft Word, and Plain Text files. Please select another file.");
return false;
}
}
The form name is "frm" and I've tried every variation possible to try and define "crap" but it just doesn't work (like including value at the end, etc.). The function is being called in an onSubmit, like this:
Code:
onsubmit="return validation_function();return validation_function2();"
[code]
In Netscape, no errors are generated, but that's just because both functions (validation_function2 & checkselects) are skipped over (in IE, checkselects works, but validation_function2 doesn't). Here is the code for the checkselects function, which doesn't function in Netscape (it is called via onclick: [code]onclick="return checkSelects(this.form);"
Code:
function checkSelects(form) {
select1 = form.Resource_Type
select2 = form.Subject_Area
select3 = form.Grade_Level
if(select1.value=='xyz') {
alert('Please select a resource type.')
return false;
}
if(select2.value=='xyz') {
alert('Please select a subject area for your resource.')
return false;
}
if(select3.value=='xyz') {
alert('Please select a grade level for your resource.')
return false;
}
return true;
}
Ryan ;-]