• 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

Disabling a text field leads to loss of value

 
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a problem retrieving value from a disabled text field.

For example, when I retrieve value from a text field which is disabled but has some text in it (i.e., filled with text and disabled), I end up retrieving only empty string not that text.

Can anyone help me how should i retrieve value from that disabled text box. I am using Struts text tag (and Struts version: 1.2)

Thanks,
Muthu
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your JSP, action form and the action class.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some (all?) browsers don't send the values of disabled input elements.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you keep any field into disable the values wont go beyond that JSP.
So instead of keeping disable keep them "readonly=true"
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sagar,
Here is the JSP where i use it. It is a DynaAction Form


and in action I try to get the value as


Kartik,
That was a good option. I am using it..

Apart from that when I googled on this, I came to know that as per HTTP specs, value of the disabled field shouldn't be carried to the server (as David said) and ppl prefer to have hidden field as an alternative to this.

Thanks ppl,
Muthu
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muthukrishnan Manoharan wrote:Apart from that when I googled on this, I came to know that as per HTTP specs, value of the disabled field shouldn't be carried to the server (as David said) and ppl prefer to have hidden field as an alternative to this.


OK, I really don't know about this, thanks for sharing !!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic