json-schema-form / angular-schema-form-bootstrap

Bootstrap decorator for Angular Schema Form
51 stars 86 forks source link

Feature: Default Select placeholder. #27

Closed eiwi1101 closed 8 years ago

eiwi1101 commented 8 years ago

There may be a method to do this, I cannot find it. Currently required Select fields are not visually flagged as required, so I would like to implement a placeholder option that is not blank, with some "select one" message, to indicate that this select field is required.

Anthropic commented 8 years ago

@eiwi1101 this is done by ensuring the first option has a valid value but, conveniently, not a blank one! Form:

"titleMap": [
  {"name":"Please Select", "value":"-"},
  {"name":"a", "value":"a"},
  {"name":"b", "value":"b"},
  {"name":"c", "value":"c"}  
]

Schema:

"enum":["-","a","b","c"]

Please re-open if you do not feel the question has been answered sufficiently.