You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Daffin, Miles (Company IT)" <Mi...@morganstanley.com> on 2004/11/19 17:19:50 UTC

Conditionally disable form input.

Hi All,
 
I want to disable a text input if a certain checkbox input has been
checked (meaning, in the following example, that the name input need not
be filled in). My jsp code looks like this:
 
<html:text
    property="<%=Keys.APPLICANT_FULLNAME_CHINESE%>"
    size="100"
 
disabled='<%=anExpressionThatDeterminesIfTheCheckboxHasBeenChecked()%>'/
>

I an using a DynaActionForm as my form bean. Ideally I suppose I would
use an expression like:
 
formBean.get(otherFieldName) != null
 
Has anyone done something like this?
 
Many thanks.
 
-Miles
 
Miles Daffin
Morgan Stanley
20 Cabot Square | Canary Wharf | London E14 4QA | UK
Tel: +44 (0) 20 767 75119
miles.daffin@morganstanley.com <ma...@morganstanley.com> 
--------------------------------------------------------
 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited.