Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validations in IE and Netscape Creating Big Problems

Status
Not open for further replies.

rmz8

Programmer
Aug 24, 2000
210
US
I have the following code (which used to work, but the page has since changed):

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 ;-]
 
-> checkSelects : maybe "form" is a reserved word in ie. Try replacing with anything (mform or whatever) - let me know
-> validation_function2 : maybe you should pass it the form as input as you do for checkSelects. Also i guess the not found value is upFile, not frm - let me know
-> about netscape, it requires very &quot;proper&quot; html : if you don't close all the tags (</option>; </select>; </form>) it doesn't read all the values
hope this helps a bit
again, let me know (well, let TT members know, as anyone here can try to help you !!! and maybe someone already has the solution !)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top