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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


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="">
in my javascript I say:
this will not work, I can set myForm.action, but not myForm.enctype, why??
what am I missing?
thank you
Posts: 15385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try:

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

    Bookmark Topic Watch Topic
  • New Topic