@@ -35,7 +35,7 @@ <h1>Schema Form Example</h1>
35
35
< div class ="row ">
36
36
< div class ="col-sm-4 ">
37
37
< h3 > The Generated Form</ h3 >
38
- < form name ="ngform " sf-model ="modelData " sf-form ="form " sf-schema ="schema "> </ form >
38
+ < form name ="ngform " sf-model ="modelData " sf-form ="form " sf-schema ="schema " ng-submit =" submitForm(ngform,modelData) " > </ form >
39
39
< h3 > Model</ h3 >
40
40
< pre ng-cloak > {{pretty()}}</ pre >
41
41
</ div >
@@ -60,10 +60,8 @@ <h3>Schema</h3>
60
60
< script type ="
text/javascript "
src ="
http://cdn.jsdelivr.net/g/[email protected] "
> </ script >
61
61
< script type ="text/javascript " src ="../bower_components/tv4/tv4.js "> </ script >
62
62
< script type ="text/javascript " src ="../bower_components/ace-builds/src-min-noconflict/ace.js "> </ script >
63
-
64
63
< script type ="text/javascript " src ="../bower_components/angular/angular.min.js "> </ script >
65
64
< script type ="text/javascript " src ="../bower_components/angular-sanitize/angular-sanitize.min.js "> </ script >
66
-
67
65
<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script> -->
68
66
<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular-sanitize.min.js"></script> -->
69
67
@@ -74,7 +72,7 @@ <h3>Schema</h3>
74
72
< script type ="text/javascript " src ="../bower_components/pickadate/lib/picker.date.js "> </ script >
75
73
< script type ="text/javascript " src ="../bower_components/pickadate/lib/translations/sv_SE.js "> </ script >
76
74
77
- < script type ="text/javascript " src ="../dist/schema-form.min. js "> </ script >
75
+ < script type ="text/javascript " src ="../dist/schema-form.js "> </ script >
78
76
< script type ="text/javascript " src ="../dist/bootstrap-decorator.min.js "> </ script >
79
77
< script type ="text/javascript " src ="../dist/bootstrap-datepicker.min.js "> </ script >
80
78
< script type ="text/javascript ">
@@ -148,6 +146,15 @@ <h3>Schema</h3>
148
146
alert ( msg ) ;
149
147
} ;
150
148
149
+ $scope . submitForm = function ( form , model ) {
150
+ // First we broadcast an event so all fields validate themselves
151
+ $scope . $broadcast ( 'schemaFormValidate' ) ;
152
+ // Then we check if the form is valid
153
+ if ( form . $valid ) {
154
+ alert ( 'You did it!' ) ;
155
+ }
156
+ }
157
+
151
158
} ) ;
152
159
153
160
</ script >
0 commit comments