Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

form.enctype

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
I have a form and depending on which button the user clicks on, different form enctype needs to be specified(one for transfering a file and the other for normal data). SO there are two cases:
1.<form enctype="multipart/form-data">
2.(the default form enctype) <form enctype="application/x-www-form-urlencoded">

However, it seems like I need to have the enctype specified in html. If I use javascript to change the form.enctype(or form.enctype.value), it won't work. For example, if I have
<form name="myForm" method="post" enctype="">
</form>
in my javascript I say:
myForm.enctype="multipart/form-data"
this will not work, I can set myForm.action, but not myForm.enctype, why??
what am I missing?
thank you
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try:

document.forms[0].encoding = "multipart/form-data";

Eric
 
    Bookmark Topic Watch Topic
  • New Topic