danhunsaker / angular-dynamic-forms

Build Forms in AngularJS From Nothing But JSON (please see Alternatives in the README)
MIT License
379 stars 140 forks source link

Increase the size of Multi select list box #60

Open skprasadu opened 9 years ago

skprasadu commented 9 years ago

Dan,

I want to increase the size of multi select list box. Default size of 4. Is there a way?

Krishna

danhunsaker commented 9 years ago

The same way you would in HTML - use the "size" attribute:

template = [
  {
    "type": "select",
    "model": "select",
    "label": "select",
    "empty": "nothing selected",
    "multiple": true,
    "attributes": {
      "size": 16
    },
    "autoOptions": "item.value as item.label for item in items"
  }
];
skprasadu commented 9 years ago

Dan, Thanks for your quick reply. I will try this alternative. For now I controlled the size through generic CSS as below,

select[multiple] { height: 200px; }

We extensively use your framework while building a quick prototype. This framework is one of the most well thought out one in creating dynamic UI. Great work.

Shortly I will build a small tutorial on how to build a decent crud based application using spring boot and dynamic forms. Please see if you can accept the pull request.

Thanks once again. Krishna

skprasadu commented 8 years ago

One more question, how to force someone to select select an element from dropdown, I did set required field to true, but when I am processing, it is just accepting if an item is not selected.

Please help me on this.

Krishna

danhunsaker commented 8 years ago

I'm not sure why that's not working... One thing to note is that the required key creates an ng-required attribute on the form element, so the value there needs to follow the format for that. If you want the required attribute instead, use attributes.required instead.

skprasadu commented 8 years ago

When I am setting attributes a control, for example select, it is setting to the label of that control. Not the control itself. Can you fix this issue? for example,

skprasadu commented 8 years ago

I realized that I can use a 'callback' and not use attributes. Thanks