light validation fo category
This commit is contained in:
parent
32915038b6
commit
510fd216e1
|
@ -14,4 +14,11 @@ $(document).ready( function () {
|
||||||
window.close();
|
window.close();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("form.form-add").submit( function(e) {
|
||||||
|
if ( $(".add-category").val() == -1) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(".add-category-col").addClass("has-error");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,15 +6,16 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-2">Link:</div><div class="col-xs-10"><input type="text" class="form-control" name="link" placeholder="Link" value="{{.link}}"/></div>
|
<div class="col-xs-2">Link:</div><div class="col-xs-10"><input type="text" class="form-control" name="link" placeholder="Link" value="{{.link}}"/></div>
|
||||||
<div class="col-xs-2">Title:</div><div class="col-xs-10"><input type="text" class="form-control" name="title" placeholder="Title" value="{{.title}}"/></div>
|
<div class="col-xs-2">Title:</div><div class="col-xs-10"><input type="text" class="form-control" name="title" placeholder="Title" value="{{.title}}"/></div>
|
||||||
<div class="col-xs-2">Category:</div><div class="col-xs-10">
|
<div class="col-xs-2">Category:</div><div class="col-xs-10 add-category-col">
|
||||||
<select class="form-control" name="category" placeholder="Tag">
|
<select class="form-control add-category" name="category" placeholder="Tag">
|
||||||
|
<option value="-1">-- Pick a Category --</option>
|
||||||
{{range $category := .categories}}
|
{{range $category := .categories}}
|
||||||
{{template "option-category" $category}}
|
{{template "option-category" $category}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-2">Notes:</div><div class="col-xs-10"><textarea class="form-control" name="notes" placeholder="Notes" rows="5" cols="80">{{.description}}</textarea></div>
|
<div class="col-xs-2">Notes:</div><div class="col-xs-10"><textarea class="form-control" name="notes" placeholder="Notes" rows="5" cols="80">{{.description}}</textarea></div>
|
||||||
<div class="col-xs-2"></div><div class="col-xs-10"><input class="btn btn-lg btn-primary btn-block" type="submit" value="Add Link" /></div>
|
<div class="col-xs-2"></div><div class="col-xs-10"><input class="add-submit btn btn-lg btn-primary btn-block" type="submit" value="Add Link" /></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue