This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Disable text input based on actionform value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Disable text input based on actionform value" Watch "Disable text input based on actionform value" New topic
Author

Disable text input based on actionform value

Mike Dell
Greenhorn

Joined: Sep 28, 2009
Posts: 10
I have a boolean value in my action form:
private boolean disableForm;

How can I disable a text input based on the value of disableForm? The follow below does not work
<html:text name="WorkForm" styleId="maildate" property="mailDate" maxlength="10" size="10" disabled="<%=disableForm.booleanValue()%>" />
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
First keep the boolean value in request in Action class.




and in jsp take in this way


The other way is from Scriplet you can do.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

The disabled attribute doesn't understands true/false values. Its value is disabled i.e. disabled="disabled". So you'll need to use a condition and generate the disabled attribute only if you want to disable the text box...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable text input based on actionform value
 
Similar Threads
how to disable text input field and change color or text box?
Disabling html:text in Struts dynamically
trouble setting a Boolean parameter
How can I disable a text input field?
Validation of Forms