Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TextItem readonly

    Hi,

    I want to set the value for TextItem by using setValue() method.

    And also I want to make it readOnly to TextItem. I tried setCanEdit(false). It shows error.(The method setCanEdit(boolean) is undefined for the type TextItem)

    My Code is

    updatedBy = new TextItem(ITPC_USER_HELP.UPDATED_BY);
    updatedBy.setValue(remoteUser);
    updatedBy.setCanEdit(false);

    Please let me know how to make it readonly.

    #2
    That API does indeed exist, it's inherited from FormItem.

    Comment


      #3
      Try StaticTextItem instead.

      BTW, if setCanEdit () is not defined or does not do the job, and you want to toggle the same TextItem between readOnly and not readOnly, I am guessing that you are stuck creating both StaticTextItem and a TextItem, keeping the values in sync between the 2, and then showing only one or the other...

      Comment


        #4
        setCanEdit() is defined and does the job.

        Comment


          #5
          I found the solution: Answer is

          textitem.setAttribute("readOnly",true);

          Comment


            #6
            BTW, setCanEdit() works for me as well, so if it does not work for you, could you post a stand-alone test case?

            Comment

            Working...
            X