Announcement Announcement Module
Collapse
No announcement yet.
Changing Form Fields after changing ComboBox Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing Form Fields after changing ComboBox

    Hello everybody!

    Does anybody have any example or tip for how to add new Form fields after changing the selection in a combobox?

    In my App (a Protegé ontology based application) I need to select first the type of Object to be instantiated (per Select List), and then after firing a ChangeListener the same form should show the new fields for the Properties of this Object. These fields are not known until the Listener is fired and the new selection is read.

    As I have found on the documentation, it could be possible using a child Form.
    But I´m not sure about the backing form objects. Must they also have a Composition relationship, or could they be fully decoupled?

    I´ve been trying this unsuccessfully long enough and have not found any examples for this issue, so I would appreciate very much any kind of help.

    Thanks

  • #2
    They can be fully decoupled, the objects in the hierarchical form model do not have to be in a composition/agregation etc.
    But when your "master" form is committed, all child forms are committed. Also, if one of the child forms contains a validation error, the form can not be comitted. In your case, even if it is an hidden one, the user will not be permitted to commit (press Ok) the form. I guess this is not what you want.

    I ran into this problem when I had to create a dynamic Wizard that allow the user to create different data. I had one master form model to which I added the form model needed and removed the form models not needed.

    Comment


    • #3
      recapitulation

      thanks one more time Hugo!

      I though I wouldn´t have any answer for this thread ... so I used two independent forms called in 2 steps to solve this.

      Now, to see if I understood correctly... here is how I would implement this:

      1 - so I would need to have a master form, which I use to put the attribute data for the instatiated Object

      2 - in a child form I would put the ComboBox for selection of the class to be instantiated

      3 - when I select some class in the list, the form is commited and the master form is reloaded with the respectives attribute fields.

      Am I right? or did I missunderstand something?

      Thanks in advance!

      Regards,

      Wagner

      Comment


      • #4
        I would like to ask an additional question:

        Is it possible (and how) to enable/disable a field based on a checkbox selection or any other property value?

        Comment


        • #5
          Originally posted by Shake View Post
          I would like to ask an additional question:

          Is it possible (and how) to enable/disable a field based on a checkbox selection or any other property value?
          Sure, you can add a change listener to a valuemodel of a property, and in that listener you can then change the fieldmetadata of another property (setting it readonly) for example.

          Comment


          • #6
            Okay, thanks. That war really easy... But didn't think of it - so thanks for your hint.

            Comment


            • #7
              problem solved

              Problem solved adding a listener on the combobox.
              Changing the selection, a itemEvent is fired and the listener
              adds a new child form to the current.

              Spring RCP is really nice!!!

              Comment


              • #8
                Thank for the hint. I helped me a lot and saved me a lot of time.

                Comment

                Working...
                X