Skip to content

Commit

Permalink
Merge branch 'release/v0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlgj committed Apr 23, 2014
2 parents 731dd46 + f024e97 commit 2bcc74e
Show file tree
Hide file tree
Showing 25 changed files with 524 additions and 120 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
v0.0.4
------
* Fieldsets now properly merge schema defaults.
* Directives for "manual" decorator usage.
* Basic support for buttons.
* Basic support for custom validation error messages.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ Schema Form currently supports the following form field types:
|:--------------|:------------------------|
| fieldset | a fieldset with legend |
| section | just a div |
| actions | horizontal button list, can only submit buttons as items |
| actions | horizontal button list, can only submit and buttons as items |
| text | input with type text |
| textarea | a textarea |
| number | input type number |
| checkbox | a checkbox |
| checkboxes | list of checkboxes |
| select | a select (single value)|
| submit | a submit button |
| button | a button |
Expand Down Expand Up @@ -171,6 +172,29 @@ General options most field types can handle:
title: "Street", //Title of field, taken from schema if available
notitle: false, //Set to true to hide title
description: "Street name", //A description, taken from schema if available
validationMessage: "Oh noes, please write a proper address" //A custom validation error message
}
```
Validation Messages
-------------------
Per default all error messages but "Required" comes from the schema validator
[tv4](https://github.com/geraintluff/tv4), this might or might not work for you.
If you supply a ´´´validationMessage´´´ proṕerty in the form definition, and if its value is a
string that will be used instead on any validation error.
If you need more fine grained control you can supply an object instead with keys matching the error
codes of [tv4](https://github.com/geraintluff/tv4). See ```tv4.errorCodes```
Ex.
```javascript
{
key: "address.street",
validationMessage: {
tv4.errorCodes.STRING_LENGTH_SHORT: "Address is too short, man.",
"default": "Just write a proper address, will you?", //Special catch all error message
"required": "I needz an address plz" //Used for required if specified
}
}
```
Expand Down Expand Up @@ -209,7 +233,16 @@ and the value is the title of the option.
type: "actions",
items: [
{ type: 'submit', title: 'Ok' }
{ type: 'button', title: 'Cancel', onClick: "cancel()" }
]
}
```
*button* can have a ```onClick``` attribute that either, as in JSON Form, is a function *or* a
string with an angular expression, as with ng-click.
[
{ type: 'button', title: 'Ok', onClick: function(){ ... } }
{ type: 'button', title: 'Cancel', onClick: "cancel()" }
[
```

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-schema-form",
"version": "0.0.3",
"version": "0.0.4",
"authors": [
"Textalk",
"David Jensen <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-decorator.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2bcc74e

Please sign in to comment.