• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form submit - Disabled INPUT fields

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form POST'ing to a servlet.
I have a couple of INPUT fields that I 'DISABLED' so the text in those fields can not be changed.

Are these 'DISABLED INPUT' form field data strings 'POSTED', if you know what I mean. Currently, when I do a request.getParameter(paramName) in the servlet, I get a null value.

Thanks.

- m
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When fields are disabled, they do not get passed with the form submission, hence why you are getting null fields. Now you have two options.

The first is ugly, it involves using JavaScript on the onsubmit handler to enable all of the disabled fields. Yucky, bit some people perfer this to the next method.

The second is rather easy, change the fields to readOnly instead of diabled. If you want to have the same look as disabled apply some css classes to those elements.

Eric
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:

The second is rather easy, change the fields to readOnly instead of diabled. If you want to have the same look as disabled apply some css classes to those elements.

Eric



You the MAN!!! I choose option 2.
Thanks.

- m...............one more stupid question on the way!
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about if we have a drop down we can't make it readonly.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use hidden fields and assign in javascript before posting to servlet.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasad, please do not cross-post the same question more than once in a forum (or even across forums). It wastes people's time when multiple redundant conversations take place.
[ July 29, 2005: Message edited by: Bear Bibeault ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic