Struts: best practice working with disabled fields

Discussion in 'Java' started by Per Jensen, Aug 31, 2004.

  1. Per Jensen

    Per Jensen Guest

    Group,

    I have a web application where some fields on a jsp page are disabled for some
    users.

    Say user 'admin' has set a bean property to true on a jsp page and
    and user 'joe' now edits a page displaying this particular Boolean
    property. (Fill in the copying of bean properties to form properties
    yourself).

    The disabled="true" is on for user joe in the Struts tag because he has
    read-only access to the field, so when the form is submitted and
    BeanUtils.copyproperties(bean, form) is used, the
    Boolean value represented by the checkmark is set to null. This is
    because the form has no value for the checkmark because it was disabled.

    This is obviously not correct, as user 'joe' had read-only access to the
    field.

    One solution is to handcode the bean.setter(form.getter), writing logic
    which takes into account a user's role.

    I wonder what the best practice is in this situation. Pointers and good
    advice much appreciated.

    Regards,
    Per
     
    Per Jensen, Aug 31, 2004
    #1
    1. Advertising

  2. Hi,

    > I have a web application where some fields on a jsp page are disabled for some
    > users.


    for not loosing these properties add a second hidden field with the same
    value to the form.


    Regards,

    Tobias
     
    Tobias Schierge, Sep 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Allen

    Re: Required fields disabled

    Scott Allen, Jul 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    478
    Scott Allen
    Jul 20, 2004
  2. PeterKellner
    Replies:
    3
    Views:
    385
    clintonG
    Jun 8, 2006
  3. grz01
    Replies:
    2
    Views:
    756
    grz01
    Sep 12, 2008
  4. sylvestre

    Problem with JS disabled fields

    sylvestre, May 27, 2004, in forum: Javascript
    Replies:
    3
    Views:
    122
  5. oldyork90
    Replies:
    1
    Views:
    181
    Jeremy J Starcher
    Sep 10, 2008
Loading...

Share This Page