mcintyre321 / FormFactory

MVC5, Core or standalone - Generate rich HTML5 forms from your ViewModels, or build them programatically
http://formfactoryaspmvc.azurewebsites.net/
MIT License
304 stars 102 forks source link

Is it possible to have multi fields in the same row? #48

Closed juanonsoftware closed 6 years ago

juanonsoftware commented 7 years ago

I have the form displaying and working well but from UI part, can some fields be configurable to display in the same row? I want to add col-* class but do not know how to inject. It's great if you could provide some guide. Thanks a lot !!

mcintyre321 commented 7 years ago

You can just create your own version of the views to override the default templates. Copy the one you want to change from the Templates project into your own /views/shared/formfactory/ directory.

If you want to make it conditional on an attribute, the PropertyVm Type which is the model for the views has a GetCustomAttributes() method you can use to get a custom attribute.

Does that make sense?

juanonsoftware commented 6 years ago

Sorry that I did not make a response sooner. I think of a more dynamic way such as:

I want row #1 of form has only 1 text input (use col-*-12)

I want row #2 will have 3 fields (such as one date, one dropdown, one text input) (use col--3, col--3, col-*-6)

Is it possible to put some logic into GetCustomAttributes to archive this ?

mcintyre321 commented 6 years ago

If you create a BootstrapColAttribute(int cols) and add that to your properties, then create a custom Views/Shared/FormFactory/Form.Property.cshtml to which looks for the attribute and adds the class if it is present, that might work.

mcintyre321 commented 6 years ago

Is your problem solved? Closing this issue as I assume it is?