i'm posting this again because i haven't received a response and this is perhaps the most imporant project of my life. please help.
i'm in a huge crunch. i've created this entire project for free for my school, and i have to present it to the faculty, and now all of these errors are coming up i'd really appreciate your help
well, my javascript problem is two fold. first, let me show you all of the code:
<SCRIPT language="JavaScript">
<!--
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;
}
function validation_function() {
if (!document.frm.Resource_Description.value){
alert('Please enter a description for your resource.');
return false;
}
<cfloop index="x" from="1" to=#form.fileuploads#>
crap = frm.upfile#x#.value;
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;
}
</cfloop>
}
//-->
</SCRIPT>
If you don't know ColdFusion, basically what the CFLOOP does is creates the code specified code (within the CFLOOP tags) as many times as necessary (thus for as many file upload fields there are). The first function is called by:
<INPUT TYPE="submit" VALUE="Submit" onClick="return checkSelects(this.form);">
The second function is called by onsubmit:
<CFFORM action="add_update.cfm" method="post" name="frm" enctype="multipart/form-data" onsubmit="return validation_function()">
The first function works well in Internet Explorer, but in Netscape the code, which doesn't generate an error, is just skipped (or so it seems).
As for the second function (which validates that a file field is filled in with only the specified formats; you helped create this, acutally), I cannot get it to work in either Internet Explorer or Netscape. I've tried changing "crap" to numerous different things (the name of the form is frm, so i tried it with that, as shown above and it still doesn't work). With the current code IE outputs "frm.upfile1.value is not an object or null." In Netscape it says "frm is not defined." However, I've tried so many different formats using form, frm, leaving out value, etc. and nothing works.
If you would like to see the page "live" on the server go to:
Then login with the UN:
jbernhardt
PW:
test
Then fill in an amount of files to upload. After clicking Submit you will be taken to the page with all of the errors. I'm using IE 5.5 and Netscape 4.7 and 6.
thanks so much in advance for your help.
Ryan ;-]
Ryan ;-]
i'm in a huge crunch. i've created this entire project for free for my school, and i have to present it to the faculty, and now all of these errors are coming up i'd really appreciate your help
well, my javascript problem is two fold. first, let me show you all of the code:
<SCRIPT language="JavaScript">
<!--
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;
}
function validation_function() {
if (!document.frm.Resource_Description.value){
alert('Please enter a description for your resource.');
return false;
}
<cfloop index="x" from="1" to=#form.fileuploads#>
crap = frm.upfile#x#.value;
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;
}
</cfloop>
}
//-->
</SCRIPT>
If you don't know ColdFusion, basically what the CFLOOP does is creates the code specified code (within the CFLOOP tags) as many times as necessary (thus for as many file upload fields there are). The first function is called by:
<INPUT TYPE="submit" VALUE="Submit" onClick="return checkSelects(this.form);">
The second function is called by onsubmit:
<CFFORM action="add_update.cfm" method="post" name="frm" enctype="multipart/form-data" onsubmit="return validation_function()">
The first function works well in Internet Explorer, but in Netscape the code, which doesn't generate an error, is just skipped (or so it seems).
As for the second function (which validates that a file field is filled in with only the specified formats; you helped create this, acutally), I cannot get it to work in either Internet Explorer or Netscape. I've tried changing "crap" to numerous different things (the name of the form is frm, so i tried it with that, as shown above and it still doesn't work). With the current code IE outputs "frm.upfile1.value is not an object or null." In Netscape it says "frm is not defined." However, I've tried so many different formats using form, frm, leaving out value, etc. and nothing works.
If you would like to see the page "live" on the server go to:
Then login with the UN:
jbernhardt
PW:
test
Then fill in an amount of files to upload. After clicking Submit you will be taken to the page with all of the errors. I'm using IE 5.5 and Netscape 4.7 and 6.
thanks so much in advance for your help.
Ryan ;-]
Ryan ;-]