aspose file tools*
The moose likes Servlets and the fly likes request Object doesn't contain disabled textfield values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request Object doesn Watch "request Object doesn New topic
Author

request Object doesn't contain disabled textfield values

ShaikSalam Bashoeb
Greenhorn

Joined: Dec 10, 2008
Posts: 24
when we disabled any textfield from html code.
then when we submit the form to servlet,
then request Object doesn't contain disabled textfield values.
I mean we cannot get that disabled textfield name in request.
Can i know why is it happening?

Any Suggestions will be appreciated..........
[ December 10, 2008: Message edited by: ShaikSalam Bashoeb ]
Srikanth Nutigattu
Ranch Hand

Joined: Oct 30, 2007
Posts: 114
Basically, you are the one "set" the value of the disabled text. The user cannot enter/modify and the form is sumnitted back. The values are not returned and you don't need them because you already "know" what you have set earlier.. isn't it???

Cheers!!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you want the value back when the form is submitted but you don't want the user to be able to change it, set the input field's readonly property.
As mentioned earlier, disabled form fields don't exist when the form is submitted.

This section of the HTML spec explains the difference between readonly and disabled fields:
http://www.w3.org/TR/html401/interact/forms.html#h-17.12
[ December 10, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Romit Bose
Ranch Hand

Joined: Oct 03, 2007
Posts: 50
I faced this issue in my last project.... i am too new to the technology to comment on why this happens, but whenevr we try to submit a page to a servlet, i found that only the enabled fields get passed with the form.... wht i did was, I submitted the form through a javascript function which i called on the onclick event of the submit button, and before submitting, I enabled the fields....


See if it works for you too,
Best Of Luck!
ShaikSalam Bashoeb
Greenhorn

Joined: Dec 10, 2008
Posts: 24
Originally posted by ShaikSalam Bashoeb:


Testing reply

Thanks for all of yours valuable suggestions, I have already solved this problem in my project, But my intention for asking this question was to know why we are not getting disabled field values from java through

and one more point i want to add is until we select any radio button we are not getting that perticular radio button name from request Object
'

If anyone says gives correct suggestion then i believe he is too brilliant.

Millions of Thanks in Advance......
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Originally posted by ShaikSalam Bashoeb:

Thanks for all of yours valuable suggestions, I have already solved this problem in my project, But my intention for asking this question was to know why we are not getting disabled field values from java through

and one more point i want to add is until we select any radio button we are not getting that perticular radio button name from request Object




Originally posted by Ben Souther :

As mentioned earlier, disabled form fields don't exist when the form is submitted.


[ December 13, 2008: Message edited by: Sudipto Shekhar ]

Regards, Sud.
SCJP 5 ScjpFAQ JLS
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Originally posted by ShaikSalam Bashoeb:
But my intention for asking this question was to know why we are not getting disabled field values from java through


This is just definied in the W3 HTML specification. It is certainly not caused by Java as you seem to think. Java is just the 'translator' here.

That said, I hope that you went for the 'readonly' approach -which is the only correct approach- and not for that Javascript solution posted here.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: request Object doesn't contain disabled textfield values