• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to get ActionForm populated from disabled field.

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.?
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think, you can use hidden field to keep data for disable field.
<input type="hidden" >
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Jagdeep Singh
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to all for the information.
reply
    Bookmark Topic Watch Topic
  • New Topic