Thanks Rick. I need to rely on the backend to decide whether to enable/disable as the requirement is a 'business rule' not an interface decision. Here are the factors:
- What 'stage' is this row of the table reached determines if this field can be changed or not. - What 'security level' the current session's user has determines enable/disable. So unfortunately, putting all this in the view would lead to huge amounts of choosings. I'd rather the view was really dumb and just reacted to decisions @ the backend. > Then you can do: > <html-el:text property="customerCode" maxlength="8"size="8" > disable="${userFormBean.customerCodeEnabled}" /> This looks promising. Thanks for your help.. Stuart On Tue, 2004-08-17 at 01:24, Rick Reumann wrote: > Stuart Guthrie wrote: > > > Hi there, > > > > What I'm trying to do is re-use the same jsp for ADD/UPDATE modes. In > > order to do this, certain field attributes will be different depending > > on the modes and sometimes even on the user's security credentials or > > the 'status' of the customer row. > > > > To this end I need to pass in the form bean whether a particular field > > is disabled or not > > I usually don't like to have my formBean take care of holding this > information. Not that it's necessarily bad, I just sort of like having > my form beans as dumb as possible and only maintain form captured > information. > > What I do in the above is base what to display on a "userAction" which > actually ends up corresponding to my dispatch Action method name. This I > will sometimes add as an ActionForm property (ie String userAction ). > > I then control the dispaly based on this userAction ( "update", "add"). > You'll end up with a bit more verbose code but I find it easier to > maintain.. so for example.... > > You might have a case where if you are doing an update you can't update > the User Name but can update other fields: > > Name: > <c:choose> > <c:when test="${userFormBean.userAction == 'update'}"> > <c:out value="${userFormBean.name}"/> > </c:when> > <c:othewise> > <html:text property="name"/> > </c:otherwise> > </c:choose> > > If you really want you can do your approach though but you'll have to > use the html-el tags > > Then you can do: > <html-el:text property="customerCode" maxlength="8"size="8" > disable="${userFormBean.customerCodeEnabled}" /> > > where customerCodeEnabled would correspond to "true" or "false" and be > set accordingly. I don't like this approach though because you'll end up > having to code a bunch of these for different fields and you've made > your backend responsible for figuring out how to display the info on the > page ( he he I say I don't like this, and now I'm on a project where the > whole application is going to be coded by meta-data to tell the front > what to display.. but still in theory I don't like it:) > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]