Ha ha I was trying this and couldn;t get it to work. My mistake was
fullAccess = true, so readOnly="%{fullAccess}" was returning true, i
meant to say readOnly="%{!fullAccess}".
thanks
On Thu, Mar 13, 2008 at 1:01 PM, Rushikesh Thakkar
<[EMAIL PROTECTED]> wrote:
> I have done it.. It goes like this:
>
> (1) The Action:
> public class PrepareScreen extends ActionSupport {
>
> private String yesOrNo;
>
> public String execute() throws Exception {
> yesOrNo = "true";
> return SUCCESS;
> }
>
> public String getYesOrNo() {
> return yesOrNo;
> }
> public void setYesOrNo(String yesOrNo) {
> this.yesOrNo = yesOrNo;
> }
> }
>
> (2) The JSP:
>
> Is Struts2 good?: <s:textfield name="choice" readonly="%{yesOrNo}"
> value="Yes, it is.."></s:textfield>
>
> regards,
> Rushikesh
>
> On Thu, Mar 13, 2008 at 3:24 PM, Richard Sayre <[EMAIL PROTECTED]>
>
> wrote:
>
> > I made a slight error
> >
> > readonly="%{fullAccess}" with s:textfield does not work but
> >
> > <input type="text" name="description" id="description" <s:if
> > test="!fullAccess">readonly="true"</s:if> />
> >
> > works.
> >
> > On Thu, Mar 13, 2008 at 10:48 AM, Richard Sayre <[EMAIL PROTECTED]>
> > wrote:
> > > If the disable attribute is present in a HTML tag it will be disable,
> > > no matter what the value of the attribute is.
> > >
> > > So if I have a s:select and I say disabled="false" it will be
> > > disabled (renders disabled="disabled").
> > >
> > > But if we have a text, and we set readonly="false" it will not be
> > editable.
> > >
> > > On my page my action determines my users access level - fullAccess
> > > (user can edit anything) or partialAccess (user can edit certian
> > > fields but see the other fields)
> > >
> > > I have a text field set up like this s:textfield
> > > readonly="%{fullAccess}". which works fine.
> > >
> > > But s:select disabled="%{fullAccess}" does not work.
> > >
> > > I tried this <s:select <s:if test="!fullAccess">disabled="true"</sif>
> > > /> But the s:if tag is causing a syntax error.
> > >
> > > The only solution I came up with was
> > >
> > > <s:if test="!fullAccess">
> > > <s:select disabed="true" .......
> > > </s:if>
> > > <s:else>
> > > <s:select .......
> > > </s:else>
> > >
> > > So I have 2 s:selects and s:radios for every radio/select
> > >
> > > I would prefer to have it like the textfields so I dont have to have 2
> > > pieces of code for each select and radio.
> > >
> > > I figured i could do an <if> around a <script> block at the bottom of
> > > the page and disable them with javascript but that might be a little
> > > confusing for future coders who have to work on this.
> > >
> > > Can anyone think of a good way to achieve this?
> > >
> > > Thanks,
> > >
> > > Rich
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]