Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Use form validation in articles
Browse files Browse the repository at this point in the history
  • Loading branch information
amoshaviv committed Aug 5, 2014
1 parent ee95616 commit e56c76a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions public/modules/articles/views/create-article.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@
<h1>New Article</h1>
</div>
<div class="col-md-12">
<form name="articleForm" class="form-horizontal" data-ng-submit="create(articleForm.$valid)" novalidate>
<form name="articleForm" class="form-horizontal" data-ng-submit="create()" novalidate>
<fieldset>
<div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.title.$invalid}">
<div class="form-group" ng-class="{ 'has-error': articleForm.title.$dirty && articleForm.title.$invalid }">
<label class="control-label" for="title">Title</label>
<div class="controls">
<input name="title" type="text" data-ng-model="title" id="title" class="form-control" placeholder="Title" required>
</div>
<div ng-show="submitted && articleForm.title.$invalid" class="help-block">
<p ng-show="articleForm.title.$error.required" class="text-danger">Title is required</p>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.content.$invalid}">
<div class="form-group">
<label class="control-label" for="content">Content</label>
<div class="controls">
<textarea name="content" data-ng-model="content" id="content" class="form-control" cols="30" rows="10" placeholder="Content" required></textarea>
</div>
<div ng-show="submitted && articleForm.content.$invalid" class="help-block">
<p ng-show="articleForm.content.$error.required" class="text-danger">Content is required</p>
<textarea name="content" data-ng-model="content" id="content" class="form-control" cols="30" rows="10" placeholder="Content"></textarea>
</div>
</div>
<div class="form-group">
Expand All @@ -32,4 +26,4 @@ <h1>New Article</h1>
</fieldset>
</form>
</div>
</section>
</section>

0 comments on commit e56c76a

Please sign in to comment.