Thanks both for your time. I have a text input followed by a checkbox for indicating that the text input is N/A. When the checkbox is checked I use javascript to disable the text input. The problem is that, if validation fails and the page comes back the checkbox is still checked (the magic of struts :-) but the text field is not still disabled.
So I think the logic tags will do the trick. -Miles > -----Original Message----- > From: McDonnell, Colm (MLIM) [mailto:[EMAIL PROTECTED] > Sent: 19 November 2004 16:42 > To: Struts Users Mailing List > Subject: RE: Conditionally disable form input. > > I'm sure Paul is correct here however just in case you are > content to submit the form when the checkbox is checked ..... > you could then conditionalise the text input field by > wrapping it in c:if or logic:equals tags in which you test > the value of some form bean property to determine whether to > enable or disable the control. > > > -----Original Message----- > From: Paul McCulloch [mailto:[EMAIL PROTECTED] > Sent: 19 November 2004 16:34 > To: 'Struts Users Mailing List' > Subject: RE: Conditionally disable form input. > > > What you are suggesting will only work if the form is > submitted after the > checkbox is checked - probably not what you or the user would > expect to > happen. > > I'd try and use JavaScript to achieve the same functionality > on the client - > the relevant event on the checkbox field could modify the > disabled flag of > the text input. > > Paul > > > -----Original Message----- > > From: Daffin, Miles (Company IT) > > [mailto:[EMAIL PROTECTED] > > Sent: 19 November 2004 16:20 > > To: [EMAIL PROTECTED] > > Subject: 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='<%=anExpressionThatDeterminesIfTheCheckboxHasBeenChe > > cked()%>'/ > > > > > > > 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 > > [EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]> > > -------------------------------------------------------- > > > > NOTICE: If received in error, please destroy and notify > > sender. Sender does not waive confidentiality or privilege, > > and use is prohibited. > > > > > > Axios Email Confidentiality Footer > Privileged/Confidential Information may be contained in this > message. If you are not the addressee indicated in this > message (or responsible for delivery of the message to such > person), you may not copy or deliver this message to anyone. > In such case, you should destroy this message, and notify us > immediately. If you or your employer does not consent to > Internet email messages of this kind, please advise us > immediately. Opinions, conclusions and other information > expressed in this message are not given or endorsed by my > Company or employer unless otherwise indicated by an > authorised representative independent of this message. > > WARNING: > While Axios Systems Ltd takes steps to prevent computer > viruses from being transmitted via electronic mail > attachments we cannot guarantee that attachments do not > contain computer virus code. You are therefore strongly > advised to undertake anti virus checks prior to accessing the > attachment to this electronic mail. Axios Systems Ltd grants > no warranties regarding performance use or quality of any > attachment and undertakes no liability for loss or damage > howsoever caused. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -------------------------------------------------------- > > If you are not an intended recipient of this e-mail, please > notify the sender, delete it and do not read, act upon, > print, disclose, copy, retain or redistribute it. Click here > for important additional terms relating to this e-mail. > http://www.ml.com/email_terms/ > -------------------------------------------------------- > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]