Announcement

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

    Add fields into a form in a dynamic way.

    Hi, I want to know if there is a way to add in a dynamic way, fields into a form. I mean what I want to do is like just press a button and another text field appear on the form. Is that possible.

    I appreciate your help.

    Best regards.

    #2
    Hi, acuellar.

    You can achieve this in the following manner:
    1. define the FormItem you want to make dynamically visible and invoke the method FormItem .setVisible(false)
    2. add the FormItem to the form using DynamicForm.setItems()
    3. define the Button item and add a click handler that invoke FormItem.show() on the item to make dynamically visible.
    Hope this can help you.

    Regards,

    Salvatore

    Comment


      #3
      Hi Turiddu, well I guess that is an alternative but what about if I want that the user have the capability of adding elements as they want. An example would be like adding stuff to a shopping list, so by just clicking a button another text field appear on the screen, and so on. I can achieve that by just setting visible true or false on the form item?

      I hope you can guide me on this issue.

      Best regards.

      Comment


        #4
        @acuellar, the answer is not really, you can bind a datasource and with a little work get something similiar, but in general you need another approach which generally means more then a single form when things are dynamic in the way your talking about.

        Comment


          #5
          Originally posted by acuellar
          Hi Turiddu, well I guess that is an alternative but what about if I want that the user have the capability of adding elements as they want. An example would be like adding stuff to a shopping list, so by just clicking a button another text field appear on the screen, and so on. I can achieve that by just setting visible true or false on the form item?

          I hope you can guide me on this issue.

          Best regards.
          You could define a SectionStack and add SectionStackSection holding the form fields you want to make dynamic. This can be useful if the forms have got the same fields and the number of forms can vary. Maybe you could use a similar approach to make single fields dynamic.
          Last edited by Turiddu; 19 Jun 2010, 01:06.

          Comment

          Working...
          X