Skip to content

Commit

Permalink
Adding example for validation on select, textarea and date input on t…
Browse files Browse the repository at this point in the history
…he sample app.
  • Loading branch information
Gabriel Inzirillo committed Nov 5, 2016
1 parent 4a63dd6 commit 55164a8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sample/src/samples/input/aurelia-validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@
md-show-errortext="false"
md-value.bind="noErrorText & validate:rules">
</md-input>

<md-input
md-label="put some text here"
md-value.bind="textareaValue & validate:rules"
md-text-area="true">
</md-input>

<select md-select="label: select a value" value.two-way="selectedItem & validate:rules">
<option value="" disabled selected>select an item</option>
<option value="item1">item 1</option>
<option value="item2">item 2</option>
<option value="item3">item 3</option>
<option value="item4">item 4</option>
</select>

<div>
<input md-datepicker="container: body; value.two-way: selectedDate & validate:rules;" type="date" placeholder="pick a date">
</div>
</div>

<div style="margin-top: 15px;">
Expand Down
9 changes: 9 additions & 0 deletions sample/src/samples/input/aurelia-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class AureliaValidation {
lastName = 'Doe';
email = '';
noErrorText = '';
textarea = '';
selectedItem = '';
selectedDate = '';

controller = null;

Expand All @@ -23,6 +26,12 @@ export class AureliaValidation {
.email()
.ensure('noErrorText')
.required()
.ensure('selectedItem').displayName('Item')
.required()
.ensure('textareaValue').displayName('Some text')
.required()
.ensure('selectedDate').displayName('Date')
.required()
.rules;

constructor(controller: ValidationController) {
Expand Down

0 comments on commit 55164a8

Please sign in to comment.