IE6 with DOM created form problem  
Author Message
David_G





PostPosted: Internet Explorer Web Development, IE6 with DOM created form problem Top

hello

i have this site:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<script>
var obj_form = document.createElement("form");
obj_form.method = "POST";
obj_form.enctype ="multipart/form-data";
obj_form.action = "/form_services/formtest.php";
obj_form.id = "form_id";
obj_form.name = "form_name";
var obj_button = document.createElement("input");
obj_button.type="submit";
var obj_file = document.createElement("input");
obj_file.type="file";
obj_file.name="_file_";
obj_form.appendChild(obj_file);
obj_form.appendChild(obj_button);
document.body.appendChild(obj_form);
</script>
</body>
</html>

my Problem is, that this works with FireFox, but not with the IE6.
IE6 doesn't accept the enctype ="multipart/form-data"; It send the standard enctype "application/x-www-form-urlencoded" to the server.

What can i do

tia
david





Internet Explorer Development1  
 
 
Wagepeace007





PostPosted: Internet Explorer Web Development, IE6 with DOM created form problem Top

I am not familiar with restrictions on the encoding type when dynamically creating forms via the DOM, but here are some workarounds:

1. Dynamically create a form via HTML rather than the DOM ( var tempHTML = "<FORM method='post' enctype='adfjlsjf'>"; etc....) and write that to a dynamically created DIV.

2. Harcode a <FORM> tag in your page and try manipulating that via the DOM rather than creating a new form.

3. Use an AJAX submission