• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Disabling html:text in Struts dynamically

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I disable a text field based on a bean property in Struts ?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only way I know that works is through a JSP scriptlet that evaluates to a boolean as in:

<html:text property="myProperty" disabled='<%=myJavaExpression.isdisabled() %>' />
 
Yevgeniy Treyvus
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that, but I get the following error:

/WEB-INF/tiles/websm/carrier/info.jsp(23,32) According to TLD or attribute directive in tag file, attribute value does not accept any expressions

But looking at the TLD itself, it says RTexpr is true.

Any ideas?
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RTexpr is true means- the value for attribute disabled has to be "true".

<html:text property="myProperty" disabled="true" />
 
Yevgeniy Treyvus
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought it meant that it took RT expression as values for arguments used by the tag (i.e) disabled="$(user.readOnly}". Is that not correct ?
[ May 05, 2005: Message edited by: Yevgeniy Treyvus ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using Struts 1.1 or above? I just ran a test (I'm using WebSphere V5.1) and this works for both a true and a false value.

Here's my code:

Action class:


jsp:


Try posting the code in your jsp, and maybe we can see what the problem is.
 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in <html:html> we have style attribute if suppose ur html property name "text1" we can give style="display:none" to make this filed visible style="display:inline"

if not just use expression <%= onj.canFieldVisible() %> ang assign to style attribute of input tag...

Gowtham G R
[email protected]
[email protected]
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic