Grouping form fields

Page 1 of 2 12 LastLast
  1. #1

    Grouping form fields

    Hi,

    is grouping form fields into fieldsets by using data annotations in model for formpanels created through FormPanelFor<XXX> possible in 2.4? If so: is there an example?

    Best regards,
    Andre
  2. #2
    Hello Andre,

    Unfortunately, there is no such the functionality in Ext.NET.

    Please clarify do you know any framework where the thing that you need is implemented?
  3. #3
    Not yet ;) Just thought it would be nice to have something like this as it would make me not think about form generation any more...

    Thanks for the info, maybe I'll give it a try and extend the formpanel with such functionality.

    Regards,
    Andr
  4. #4
    Ok, thanks for clarifying.

    How would we group the fields? I mean could you describe in a bit more details the functionality that you need? A verbal prototype.
  5. #5
    Here we go ;)

    /* billing data */
    
    [Group("Billing")]
    public string Name { get; set; }
    
    [Group("Billing")]
    public string Street { get; set; }
    
    [Group("Billing")]
    public string City { get; set; }
    
    [Group("Billing")]
    public string Zip { get; set; }
    
    [Group("Billing")]
    public string Country { get; set; }
    
    /* delivery data */
    
    [Group("Delivery")]
    public string DeliveryName { get; set; }
    
    [Group("Delivery")]
    public string DeliveryStreet { get; set; }
    
    [Group("Delivery")]
    public string DeliveryCity { get; set; }
    
    [Group("Delivery")]
    public string DeliveryZip { get; set; }
    
    [Group("Delivery")]
    public string DeliveryCountry { get; set; }
    I would expect the billing data and the delivery data to be rendered into two different fieldsets. That would require some config options for grouping (for example order/title of fieldsets).

    I hope that makes it somehow clear.

    Best regards,
    Andr
  6. #6
    That would require some config options for grouping (for example order/title of fieldsets).
    Yes, that is the key.

    Ideally, how much view logic should reside in the Business layer?
    Geoffrey McGill
    Founder
  7. #7
    Hi,

    in a representative survey two options crystallized:

    • We provide a "fieldset model" which would be taken into account when the form is rendered so the fieldsets are created by Ext.NET if that model is provided and then the fields will be added rather to that fieldsets than the form items itself.

    • There is an extension methods to FormPanelFor to add the fieldsets on our own before any field is added so we could use the ExtJS beforeadd event of the formpanel to add the fields into the appropriate fieldset instead of adding the field to the formpanels items collection directly (which would require the fields to provide the grouping information from the server-side model).


    As I'm writing this I start to like the second option more and more since we could not only use fieldsets directly but also wrap fieldsets into panels/card layouts/tabpanels for layout and usability reasons.

    Best regards,
    Andre
    Last edited by atze187; Aug 27, 2014 at 2:30 PM.
  8. #8
    I think the Geoffrey's statement is still actual
    Ideally, how much view logic should reside in the Business layer?
    You tend to configure a layout in a Model. Well, it might be an option and nice to have built-in. Though, a bit controversial. Also I can imagine that it might be quite challenging to implement it in a generic manner to have in the toolkit.
  9. #9
    Hi Daniil,

    to me, if I didn't make that clear, the second option is the better solution and I would be satisfied if the attributes ("Group" in the example) of the model properties would be passed to the data of the created item as "meta data" (don't know if ExtJS has such structures built-in). Then I would be happy to use the ExtJS events to create the needed containers (fieldsets/tabs/panels/...) on my own and move the items to the appropriate containers.

    Sunny pre-weekend cheers from Berlin,
    Andr
  10. #10
    It sounds interesting. As far as I can see, at this point there is no a possibility to do that:
    (which would require the fields to provide the grouping information from the server-side model)
    Maybe, at some point we will review that.

    At this point I can suggest you to implement your own helper, like MyFormPanelFor. This tutorial might be helpful.
    http://forums.ext.net/showthread.php?27672

    Sunny pre-weekend cheers from Berlin
    Thank you!
Page 1 of 2 12 LastLast

Similar Threads

  1. Widths of Form fields
    By thedarklord in forum 2.x Help
    Replies: 2
    Last Post: Oct 08, 2012, 5:31 AM
  2. [CLOSED] Not all form fields are submitted
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: May 05, 2010, 12:58 PM
  3. [CLOSED] Form does not show the fields
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 26, 2010, 4:00 PM
  4. Mask formatter for form fields
    By olimpia in forum 1.x Help
    Replies: 3
    Last Post: Jun 08, 2009, 10:42 AM
  5. Adding Form fields at run time
    By sz_146 in forum 1.x Help
    Replies: 1
    Last Post: Feb 10, 2009, 6:18 PM

Tags for this Thread

Posting Permissions