Announcement

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

    Editor-FieldItems like TextItem transform to StaticTextItem

    To have a confirmation page of a form,
    where the user used several FormItems like TextItem and SelectItem:

    If the user clicks on save, we need to change the type of TextItem and SelectItem to StaticTextItems, so that the user is not able to use the items and see the values like in a list, without having a disable view.

    On initialization you can achieve this with
    myField.setAttribute("editorType", "StaticTextItem");

    but not afterwards, when the user clicked on save.

    I tried something like

    Code:
     for(FormItem field : getForm().getFields()){
                        field.setAttribute("editorType", "StaticTextItem");
                        field.updateState();
                    }
                 form.redraw();
    But this doesn't take any effect.

    Do you have a solution in mind?

    Thanks

    #2
    You can create two forms: one with statictextitems and the other with the editable fields and hide/show the correct one based on the form state. You cannot change field types on the fly.

    Comment


      #3
      Yeah, but with currently having about 6 forms with special behavior and properties, it would mean to have 12.
      This could be a last solution taken into consideration.
      Also values have to be moved to other form ( I know it's easily possible)

      Is there any better way ?

      Comment


        #4
        It sounds as though you might want to take a DetailViewer, bind it to the same DataSource, and provide it with the values in the form.

        Comment


          #5
          Thanks for this ideas.

          I'll try it first with changing css styles,
          if there is a limitation I'll try to create a new instance of form/detailviewer for different appereance to the user

          Comment


            #6
            Setting the fields disabled, using css, so that they don't look disabled and don't display selecItem icons
            seems to work for me.

            It is working for all browsers, because SmartClient uses own Disabled class, but not the disabled property on input

            Comment


              #7
              I know this post is old, but if you have notifications set up to get a email when someone responds to your post can you tell me how you did this.

              I also tried a method to set the attribute to use the StaticTextItem style with no luck. (setAttribute("editorType", "StaticTextItem");)

              I want the StaticTextItem look, but I need to be able to access the data and StaticTextItem.getValueAsString() ect. does not exist
              Last edited by DEvans87; 19 Sep 2012, 05:20.

              Comment

              Working...
              X