| Author |
How to get ActionForm populated from disabled field.
|
Jagdeep Singh
Ranch Hand
Joined: Oct 14, 2002
Posts: 106
|
|
|
I am using html select tag in JSP. Based on some value I set attribute "disabled" to true so that field value is not selectable but should still show default value in current context. Now the problem is that if i set field disabled, the field value is not available in ActionForm in Action. How to do handle this kind of situation in Struts.?
|
Jagdeep Singh<br />SCJP;SCWCD;IBM Certified XML Solution Developer;SCBCD1.3
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 23635
|
|
Jagdeep, This is a problem in HTML in general. If a form element is disabled, the browser does not submit it's value. If you need the value, there are two choices: 1) don't disable the form element 2) write your own javascript function to set the element's value to a temporary text field and have the action set it to the form value for you
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
|
 |
somkiat puisungnoen
Ranch Hand
Joined: Jul 04, 2003
Posts: 1312
|
|
I think, you can use hidden field to keep data for disable field. <input type="hidden" >
|
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
|
 |
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
I am using non-Struts tags to handle disable or display-only fields in the views, and put these fields into hidden variables. Since the request parameter will be kept as the request parameters, and thus, you can always get it from request by EL. Nick [ May 18, 2004: Message edited by: Nicholas Cheung ]
|
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
|
 |
Jagdeep Singh
Ranch Hand
Joined: Oct 14, 2002
Posts: 106
|
|
Thanks to all for the information.
|
 |
 |
|
|
subject: How to get ActionForm populated from disabled field.
|
|
|