You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Session A Mwamufiya <sm...@andrew.cmu.edu> on 2007/08/13 12:40:46 UTC
Evaluating a javascript expression in order to set the readonly
attribute
Hi,
I would like to set a textbox to readonly when a flag is set in my action. I have the following jsp call:
<s:textfield name="name" label="Name" readonly="if(%{editingFlag==true}){return 'true'}"/>
but the textfield is not readonly, and the page source reflects it. BTW, editingFlag is set in the prepare() method of my action.
Any idea on how to write the evaluation?
Thanks,
Session
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE Evaluating a javascript expression in order to set the readonly
attribute
Posted by ML...@abusinessware.com.
In your Action, add an String attribute named editingFlag with a getter
and a setter. Set the value ("true" or "false") of editingFlag in the
method forwarding to your JSP.
In the JSP :
<s:textfield name="name" label="Name" readonly="${editingFlag)"/>
"Session A Mwamufiya" <sm...@andrew.cmu.edu>
13/08/2007 12:46
Veuillez répondre à
"Struts Users Mailing List" <us...@struts.apache.org>
A
user@struts.apache.org
cc
Objet
Evaluating a javascript expression in order to set the readonly attribute
Hi,
I would like to set a textbox to readonly when a flag is set in my action.
I have the following jsp call:
<s:textfield name="name" label="Name"
readonly="if(%{editingFlag==true}){return 'true'}"/>
but the textfield is not readonly, and the page source reflects it. BTW,
editingFlag is set in the prepare() method of my action.
Any idea on how to write the evaluation?
Thanks,
Session
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Evaluating a javascript expression in order to set the readonly attribute
Posted by Dave Newton <ne...@yahoo.com>.
--- Session A Mwamufiya wrote:
> <s:textfield name="name" label="Name"
> readonly="if(%{editingFlag==true}){return 'true'}"/>
>
> but the textfield is not readonly, and the page
> source reflects it. BTW, editingFlag is set in the
> prepare() method of my action.
>
> Any idea on how to write the evaluation?
Try something like:
%{editingFlag}
d.
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org