emberjs-addons/ember-bootstrap

Support for required, rows, cols, placeholder, disabled, maxlength

devilankur18 opened this issue · 3 comments

Ember default TextField provide a support to a lot of html attributes
http://emberjs.com/api/classes/Ember.TextArea.html

I was trying the required html attribute

{{view Bootstrap.Forms.TextField valueBinding="name" label="Name" help="Name of the project" required="true" }}

If the fields is empty it should show the error mentioning that this field is required. Like this provide it

<div class="control-group">
  <label class="control-label" for="name">Name</label>
  <div class="controls">
    {{view Ember.TextField valueBinding="name" id="name" placeholder="Name" required="true"}}
  </div>
</div>

rows and cols are already available.
For the other fields, please feel free to open a pull request adding them.

Check out Bootstrap.Forms.TextField, Bootstrap.Forms.TextArea and the shared Bootstrap.Forms.TextSupport.

If there are attributes missing there that Ember provides please submit a PR.

If you check the documentation you've linked, required isn't available by default on an Ember.TextArea, they're actually showing you how to add it using attributeBindings.

The best way for you to add required to your inputs requires reopening Bootstrap.TextSupport and Ember.TextSupport.

Ember.TextSupport.reopen({
  attributeBindings: ["required"]
})

Bootstrap.TextSupport.reopen({
  requiredBinding: "parentView.required"
})

@bradleypriest Thanks, it worked perfectly.