aspose file tools*
The moose likes Struts and the fly likes Disabling a text field leads to loss of value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Disabling a text field leads to loss of value" Watch "Disabling a text field leads to loss of value" New topic
Author

Disabling a text field leads to loss of value

Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

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
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Post your JSP, action form and the action class.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Some (all?) browsers don't send the values of disabled input elements.
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
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

Joined: Aug 27, 2008
Posts: 91

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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disabling a text field leads to loss of value