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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with setting form enctype with javascript

Status
Not open for further replies.

stewartalan

Programmer
Oct 14, 2002
3
0
0
GB
I have a form that is sent to a javascript function that first determines if a file has been selected to upload along with it. If there is a file the form is sent to one page with a multipart/form-data enctype and if there is no file then it is sent elswhere witout this enctype.

My Function is thus

function filechecker() {
if (document.FormName.file.value == "")
{
document.FormName.action = "page1.asp";
document.FormName.encoding = "text/html";
document.FormName.method = "POST"
}else{
document.FormName.action = "page2.asp";
document.FormName.encoding = "multipart/form-data";
document.FormName.method = "POST"
}
document.FormName.submit();
}

This does not work and I get a javascript error when trying to submit the form that says 'Could not get the encoding property. Invalid Arguement'

Can anyone tell me where I am going wrong??

Thanks

Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top