@@ -178,15 +178,39 @@ General options most field types can handle:
178178 title: " Street" , // Title of field, taken from schema if available
179179 notitle: false , // Set to true to hide title
180180 description: " Street name" , // A description, taken from schema if available
181- validationMessage: " Oh noes, please write a proper address" // A custom validation error message
181+ validationMessage: " Oh noes, please write a proper address" , // A custom validation error message
182+ onChange: " valueChanged(form.key,modelValue)" // onChange event handler, expression or function
182183}
183184```
184185
185- Validation Messages
186- -------------------
186+ ### onChange
187+ The ``` onChange ``` option can be used with most fields and its value should be
188+ either an angular expression, as a string, or a function. If its an expression
189+ it will be evaluated in the parent scope of the ``` sf-schema ``` directive with
190+ the special locals ``` modelValue ``` and ``` form ``` . If its a function that will
191+ be called with ``` modelValue ``` and ``` form ``` as first and second arguments.
192+
193+ ex.
194+ ``` javascript
195+ $scope .form = [
196+ {
197+ key: " name" ,
198+ onChange: " updated(modelValue,form)"
199+ },
200+ {
201+ key: " password" ,
202+ onChange : function (modelValue ,form ) {
203+ console .log (" Password is" ,modelValue);
204+ }
205+ }
206+ ];
207+ ```
208+
209+ ### Validation Messages
210+
187211Per default all error messages but "Required" comes from the schema validator
188212[ tv4] ( https://github.com/geraintluff/tv4 ) , this might or might not work for you.
189- If you supply a ´´´ validationMessage´´´ proṕerty in the form definition, and if its value is a
213+ If you supply a ``` validationMessage ``` property in the form definition, and if its value is a
190214string that will be used instead on any validation error.
191215
192216If you need more fine grained control you can supply an object instead with keys matching the error
0 commit comments